Author: William ML Leslie <william.leslie....@gmail.com>
Branch: verbose-imports
Changeset: r83903:408072cca2fc
Date: 2016-04-26 22:03 +1000
http://bitbucket.org/pypy/pypy/changeset/408072cca2fc/

Log:    Log nothing if sys hasn't been imported yet

diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -56,9 +56,10 @@
     return '.' + soabi + SO
 
 def log_pyverbose(space, level, message):
-    w_flags = space.sys.get('flags')
-    w_verbose = space.getattr(w_flags, 'verbose')
-    if space.int_w(w_verbose) >= level:
+    if space.sys.w_initialdict is None:
+        return # sys module not initialised, avoid recursion
+    w_verbose = space.sys.get_flag('verbose')
+    if w_verbose >= level:
         w_stderr = space.sys.get('stderr')
         space.call_method(w_stderr, "write", space.wrap(message))
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to