mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Avoid importing a non-vendored version of Tornado
Code depending on this conditional import could break if an old version of Tornado is present in the environment, rendering pip unusable.
This commit is contained in:
parent
74580b13fb
commit
b8f1fcf863
3 changed files with 28 additions and 4 deletions
1
news/10020.bugfix.rst
Normal file
1
news/10020.bugfix.rst
Normal file
|
@ -0,0 +1 @@
|
|||
Remove unused optional ``tornado`` import in vendored ``tenacity`` to prevent old versions of Tornado from breaking pip.
|
|
@ -22,10 +22,12 @@ try:
|
|||
except ImportError:
|
||||
iscoroutinefunction = None
|
||||
|
||||
try:
|
||||
import tornado
|
||||
except ImportError:
|
||||
tornado = None
|
||||
# Replace a conditional import with a hard-coded None so that pip does
|
||||
# not attempt to use tornado even if it is present in the environment.
|
||||
# If tornado is non-None, tenacity will attempt to execute some code
|
||||
# that is sensitive to the version of tornado, which could break pip
|
||||
# if an old version is found.
|
||||
tornado = None
|
||||
|
||||
import sys
|
||||
import threading
|
||||
|
|
21
tools/vendoring/patches/tenacity.patch
Normal file
21
tools/vendoring/patches/tenacity.patch
Normal file
|
@ -0,0 +1,21 @@
|
|||
diff --git a/src/pip/_vendor/tenacity/__init__.py b/src/pip/_vendor/tenacity/__init__.py
|
||||
index 5f8cb5058..42e9d8940 100644
|
||||
--- a/src/pip/_vendor/tenacity/__init__.py
|
||||
+++ b/src/pip/_vendor/tenacity/__init__.py
|
||||
@@ -22,10 +22,12 @@ try:
|
||||
except ImportError:
|
||||
iscoroutinefunction = None
|
||||
|
||||
-try:
|
||||
- import tornado
|
||||
-except ImportError:
|
||||
- tornado = None
|
||||
+# Replace a conditional import with a hard-coded None so that pip does
|
||||
+# not attempt to use tornado even if it is present in the environment.
|
||||
+# If tornado is non-None, tenacity will attempt to execute some code
|
||||
+# that is sensitive to the version of tornado, which could break pip
|
||||
+# if an old version is found.
|
||||
+tornado = None
|
||||
|
||||
import sys
|
||||
import threading
|
Loading…
Reference in a new issue