File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -32,11 +32,15 @@ def vendored(modulename):
32
32
try :
33
33
__import__ (modulename , globals (), locals (), level = 0 )
34
34
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
40
44
else :
41
45
sys .modules [vendored_name ] = sys .modules [modulename ]
42
46
base , head = vendored_name .rsplit ("." , 1 )
You can’t perform that action at this time.
0 commit comments