mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1335873 - Check for .pyc's existence before deleting it in mach_bootstrap import hook, r=glandium
This situation can happen if we attempt to import a module we know might not exist, for example: https://dxr.mozilla.org/mozilla-central/rev/d0462b0948e0b1147dcce615bddcc46379bdadb2/testing/mozbase/mozlog/mozlog/formatters/machformatter.py#9 MozReview-Commit-ID: CTg775kN72h --HG-- extra : rebase_source : 8026d22f3b256be15069feac306876627819ba99
This commit is contained in:
parent
a4ffbf4dcc
commit
1e34f705c0
@ -408,7 +408,8 @@ class ImportHook(object):
|
||||
# python modules under our source directory (either because it
|
||||
# doesn't happen or because it doesn't matter).
|
||||
if not os.path.exists(module.__file__[:-1]):
|
||||
os.remove(module.__file__)
|
||||
if os.path.exists(module.__file__):
|
||||
os.remove(module.__file__)
|
||||
del sys.modules[module.__name__]
|
||||
module = self(name, globals, locals, fromlist, level)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user