Skip to content

Commit 1db60b2

Browse files
authored
Merge pull request #12929 from sethmlarson/truststore-0.9.2
Upgrade truststore to 0.9.2
2 parents b0ebea9 + 9ab7586 commit 1db60b2

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

news/truststore.vendor.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade truststore to 0.9.2

src/pip/_vendor/truststore/__init__.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,32 @@
55
if _sys.version_info < (3, 10):
66
raise ImportError("truststore requires Python 3.10 or later")
77

8+
# Detect Python runtimes which don't implement SSLObject.get_unverified_chain() API
9+
# This API only became public in Python 3.13 but was available in CPython and PyPy since 3.10.
10+
if _sys.version_info < (3, 13):
11+
try:
12+
import ssl as _ssl
13+
except ImportError:
14+
raise ImportError("truststore requires the 'ssl' module")
15+
else:
16+
_sslmem = _ssl.MemoryBIO()
17+
_sslobj = _ssl.create_default_context().wrap_bio(
18+
_sslmem,
19+
_sslmem,
20+
)
21+
try:
22+
while not hasattr(_sslobj, "get_unverified_chain"):
23+
_sslobj = _sslobj._sslobj # type: ignore[attr-defined]
24+
except AttributeError:
25+
raise ImportError(
26+
"truststore requires peer certificate chain APIs to be available"
27+
) from None
28+
29+
del _ssl, _sslobj, _sslmem # noqa: F821
30+
831
from ._api import SSLContext, extract_from_ssl, inject_into_ssl # noqa: E402
932

1033
del _api, _sys # type: ignore[name-defined] # noqa: F821
1134

1235
__all__ = ["SSLContext", "inject_into_ssl", "extract_from_ssl"]
13-
__version__ = "0.9.1"
36+
__version__ = "0.9.2"

src/pip/_vendor/vendor.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ rich==13.7.1
1515
resolvelib==1.0.1
1616
setuptools==70.3.0
1717
tomli==2.0.1
18-
truststore==0.9.1
18+
truststore==0.9.2

0 commit comments

Comments
 (0)