Skip to content

Commit b215120

Browse files
committed
Revert "Merge pull request pypa#8391 from VikramJayanthi17/error-swallow-fix"
This reverts commit 7a60395, reversing changes made to d3ce025. It fixes devendored pip. See pypa#8916. Signed-off-by: Filipe Laíns <[email protected]>
1 parent 75befb5 commit b215120

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/pip/_vendor/__init__.py

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

0 commit comments

Comments
 (0)