-
Couldn't load subscription status.
- Fork 3.2k
Avoid importing a non-vendored version of Tornado #10029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this up!
news/10020.bugfix.rst
Outdated
| @@ -0,0 +1 @@ | |||
| The presence of an old version of Tornado (before 4.1) in the environment no longer breaks pip. No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe the problem in past tense, and the fix in present tense (because that's what makes sense after the release is made). So maybe something like
Remove unused optional
tornadoimport in vendoredtenacityto avoid an old version ortornadoinstallation from breaking pip.
src/pip/_vendor/tenacity/__init__.py
Outdated
| import tornado | ||
| # Pip does not currently vendor Tornado, so this will take the | ||
| # ImportError path. | ||
| from pip._vendor import tornado |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to patch the entire block to tornado = None. If the import always fails, we don't need to try that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to make that change. It was my original plan, but I decided to use from pip._vendor import tornado so that in the (unlikely) event pip adds Tornado to its vendored dependencies things will just work and you won't be left with a copy of tenacity that mostly works but breaks if it interacts with tornado.
| except ImportError: | ||
| tornado = None | ||
|
|
||
|
No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix this lack of trailing newline.
17f2f7e to
3b655ef
Compare
|
Branch is updated with all requested changes. |
src/pip/_vendor/tenacity/__init__.py
Outdated
| except ImportError: | ||
| tornado = None | ||
| # Pip does not currently vendor Tornado, so don't import it even if it | ||
| # happens to be installed in the environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I read this comment for the first time, I’d think to myself “OK but that works without the patch as well, so is this unnecessary”?
I’d mention why the patch is needed instead to avoid this confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Code depending on this conditional import could break if an old version of Tornado is present in the environment, rendering pip unusable.
|
Thank you @bdarnell! ^>^ |
Code depending on this conditional import could break if an old
version of Tornado is present in the environment, rendering pip
unusable.
Fixes #10020