From 8ef2191a097b015139fba6bba9c0992da503d62e Mon Sep 17 00:00:00 2001 From: Vikram - Google Date: Tue, 2 Jun 2020 16:45:48 -0700 Subject: [PATCH 1/2] Fixed Error Swallowing outlined in issue 5354 --- src/pip/_vendor/__init__.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/pip/_vendor/__init__.py b/src/pip/_vendor/__init__.py index c3db83ff6aa..581db54c8d8 100644 --- a/src/pip/_vendor/__init__.py +++ b/src/pip/_vendor/__init__.py @@ -32,15 +32,11 @@ def vendored(modulename): try: __import__(modulename, globals(), locals(), level=0) except ImportError: - # 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 + # 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 else: sys.modules[vendored_name] = sys.modules[modulename] base, head = vendored_name.rsplit(".", 1) From 2244868237a893ee656f8955a9d1a2cf9ccf22d6 Mon Sep 17 00:00:00 2001 From: Vikram - Google Date: Tue, 2 Jun 2020 16:49:28 -0700 Subject: [PATCH 2/2] Added .trivial file in news dir --- news/error-swallow.trivial | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 news/error-swallow.trivial diff --git a/news/error-swallow.trivial b/news/error-swallow.trivial new file mode 100644 index 00000000000..e69de29bb2d