mirror of https://github.com/pypa/pip
Revert "Merge pull request #8391 from VikramJayanthi17/error-swallow-fix"
This reverts commit7a60395dbd
, reversing changes made tod3ce025e8d
. It fixes devendored pip. See #8916. Signed-off-by: Filipe Laíns <lains@archlinux.org>
This commit is contained in:
parent
75befb5a44
commit
b215120b5a
|
@ -32,11 +32,15 @@ def vendored(modulename):
|
||||||
try:
|
try:
|
||||||
__import__(modulename, globals(), locals(), level=0)
|
__import__(modulename, globals(), locals(), level=0)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# This error used to be silenced in earlier variants of this file, to instead
|
# We can just silently allow import failures to pass here. If we
|
||||||
# raise the error when pip actually tries to use the missing module.
|
# got to this point it means that ``import pip._vendor.whatever``
|
||||||
# Based on inputs in #5354, this was changed to explicitly raise the error.
|
# failed and so did ``import whatever``. Since we're importing this
|
||||||
# Re-raising the exception without modifying it is an intentional choice.
|
# upfront in an attempt to alias imports, not erroring here will
|
||||||
raise
|
# 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:
|
else:
|
||||||
sys.modules[vendored_name] = sys.modules[modulename]
|
sys.modules[vendored_name] = sys.modules[modulename]
|
||||||
base, head = vendored_name.rsplit(".", 1)
|
base, head = vendored_name.rsplit(".", 1)
|
||||||
|
|
Loading…
Reference in New Issue