Skip to content

Commit

Permalink
Avoid importing a non-vendored version of Tornado
Browse files Browse the repository at this point in the history
Code depending on this conditional import could break if an old
version of Tornado is present in the environment, rendering pip
unusable.

Fixes pypa#10020
  • Loading branch information
Ben Darnell committed May 28, 2021
1 parent 74580b1 commit 0b187f2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/10020.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The presence of an old version of Tornado (before 4.1) in the environment no longer breaks pip.
4 changes: 3 additions & 1 deletion src/pip/_vendor/tenacity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
iscoroutinefunction = None

try:
import tornado
# Pip does not currently vendor Tornado, so this will take the
# ImportError path.
from pip._vendor import tornado
except ImportError:
tornado = None

Expand Down
16 changes: 16 additions & 0 deletions tools/vendoring/patches/tenacity.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/src/pip/_vendor/tenacity/__init__.py b/src/pip/_vendor/tenacity/__init__.py
index 5f8cb50..571d2a3 100644
--- a/src/pip/_vendor/tenacity/__init__.py
+++ b/src/pip/_vendor/tenacity/__init__.py
@@ -23,7 +23,9 @@ except ImportError:
iscoroutinefunction = None

try:
- import tornado
+ # Pip does not currently vendor Tornado, so this will take the
+ # ImportError path.
+ from pip._vendor import tornado
except ImportError:
tornado = None


0 comments on commit 0b187f2

Please sign in to comment.