File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 84
84
compileall :
85
85
# Run 'python -m compileall' on an old Python version
86
86
# to ensure that pip can vendor truststore successfully.
87
- runs-on : ubuntu-latest
87
+ runs-on : ubuntu-22.04 # pin to 22.04, as with 24.04 Python 3.7 is no longer available
88
88
name : compileall
89
89
steps :
90
90
- uses : actions/checkout@v4
Original file line number Diff line number Diff line change 5
5
import sys
6
6
import typing
7
7
8
- import _ssl # type: ignore[import-not-found]
8
+ import _ssl
9
9
10
10
from ._ssl_constants import (
11
11
_original_SSLContext ,
@@ -43,6 +43,23 @@ def inject_into_ssl() -> None:
43
43
except ImportError :
44
44
pass
45
45
46
+ # requests starting with 2.32.0 added a preloaded SSL context to improve concurrent performance;
47
+ # this unfortunately leads to a RecursionError, which can be avoided by patching the preloaded SSL context with
48
+ # the truststore patched instance
49
+ # also see https://github.com/psf/requests/pull/6667
50
+ try :
51
+ import requests .adapters
52
+
53
+ preloaded_context = getattr (requests .adapters , "_preloaded_ssl_context" , None )
54
+ if preloaded_context is not None :
55
+ setattr (
56
+ requests .adapters ,
57
+ "_preloaded_ssl_context" ,
58
+ SSLContext (ssl .PROTOCOL_TLS_CLIENT ),
59
+ )
60
+ except ImportError :
61
+ pass
62
+
46
63
47
64
def extract_from_ssl () -> None :
48
65
"""Restores the :class:`ssl.SSLContext` class to its original state"""
You can’t perform that action at this time.
0 commit comments