[pypy-commit] pypy default: Add a bit of logging to the zipimport module, like CPython.
mjacob
pypy.commits at gmail.com
Mon Mar 20 15:26:27 EDT 2017
Author: Manuel Jacob <me at manueljacob.de>
Branch:
Changeset: r90769:95e281b50ed4
Date: 2017-03-20 20:24 +0100
http://bitbucket.org/pypy/pypy/changeset/95e281b50ed4/
Log: Add a bit of logging to the zipimport module, like CPython.
diff --git a/pypy/module/zipimport/interp_zipimport.py b/pypy/module/zipimport/interp_zipimport.py
--- a/pypy/module/zipimport/interp_zipimport.py
+++ b/pypy/module/zipimport/interp_zipimport.py
@@ -263,11 +263,18 @@
if compiled:
w_result = self.import_pyc_file(space, fullname, fname,
buf, pkgpath)
- if w_result is not None:
- return w_result
+ if w_result is None:
+ continue
else:
- return self.import_py_file(space, fullname, fname,
+ w_result = self.import_py_file(space, fullname, fname,
buf, pkgpath)
+ if space.sys.get_flag('verbose') >= 1:
+ w_stderr = space.sys.get('stderr')
+ message = "import %s # loaded from Zip %s%s%s\n" % (
+ fullname, self.filename, os.path.sep, fname)
+ space.call_method(w_stderr, "write",
+ space.newtext(message))
+ return w_result
except:
w_mods = space.sys.get('modules')
space.call_method(w_mods, 'pop', space.newtext(fullname), space.w_None)
More information about the pypy-commit
mailing list