Revert "Merge pull request #8391 from VikramJayanthi17/error-swallow-fix"

This reverts commit 7a60395dbd, reversing
changes made to d3ce025e8d.

It fixes devendored pip. See #8916.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
This commit is contained in:
Filipe Laíns 2020-09-26 14:41:42 +01:00
parent 75befb5a44
commit b215120b5a
No known key found for this signature in database
GPG Key ID: F893C674816AA95D
1 changed files with 9 additions and 5 deletions

View File

@ -32,11 +32,15 @@ def vendored(modulename):
try:
__import__(modulename, globals(), locals(), level=0)
except ImportError:
# This error used to be silenced in earlier variants of this file, to instead
# raise the error when pip actually tries to use the missing module.
# Based on inputs in #5354, this was changed to explicitly raise the error.
# Re-raising the exception without modifying it is an intentional choice.
raise
# We can just silently allow import failures to pass here. If we
# got to this point it means that ``import pip._vendor.whatever``
# failed and so did ``import whatever``. Since we're importing this
# upfront in an attempt to alias imports, not erroring here will
# just mean we get a regular import error whenever pip *actually*
# tries to import one of these modules to use it, which actually
# gives us a better error message than we would have otherwise
# gotten.
pass
else:
sys.modules[vendored_name] = sys.modules[modulename]
base, head = vendored_name.rsplit(".", 1)