summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBen Darnell <>2021-05-28 16:01:41 +0000
committerBen Darnell <ben@bendarnell.com>2021-05-30 11:26:48 -0400
commitb8f1fcf863081fde0b9d558759c0e3c46ce09a12 (patch)
tree511bc175b326deba2615e6f785aeb1f61f312a70 /tools
parent74580b13fb131f2346f4c7412a60df134c7448f7 (diff)
downloadpip-b8f1fcf863081fde0b9d558759c0e3c46ce09a12.tar.gz
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.
Diffstat (limited to 'tools')
-rw-r--r--tools/vendoring/patches/tenacity.patch21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/vendoring/patches/tenacity.patch b/tools/vendoring/patches/tenacity.patch
new file mode 100644
index 000000000..006588b36
--- /dev/null
+++ b/tools/vendoring/patches/tenacity.patch
@@ -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