Skip to content

Commit 7a60395

Browse files
authored
Merge pull request #8391 from VikramJayanthi17/error-swallow-fix
Re-think error swallowing for de-vendored packages #5354
2 parents d3ce025 + 2244868 commit 7a60395

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

news/error-swallow.trivial

Whitespace-only changes.

src/pip/_vendor/__init__.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,11 @@ def vendored(modulename):
3232
try:
3333
__import__(modulename, globals(), locals(), level=0)
3434
except ImportError:
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
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
4440
else:
4541
sys.modules[vendored_name] = sys.modules[modulename]
4642
base, head = vendored_name.rsplit(".", 1)

0 commit comments

Comments
 (0)