[pypy-svn] pypy default: Try to remove thousands of warnings saying "prebuilt instance <pypy.interpreter.gateway.BuiltinCode1> has no attribute 'co_filename'

amauryfa commits-noreply at bitbucket.org
Tue Mar 22 23:45:12 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r42852:8560e39f47b1
Date: 2011-03-22 23:44 +0100
http://bitbucket.org/pypy/pypy/changeset/8560e39f47b1/

Log:	Try to remove thousands of warnings saying "prebuilt instance
	<pypy.interpreter.gateway.BuiltinCode1> has no attribute
	'co_filename'

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
@@ -775,14 +775,16 @@
         if space.config.objspace.usepycfiles and write_pyc:
             write_compiled_module(space, code_w, cpathname, mode, mtime)
 
-    update_code_filenames(space, code_w, pathname, code_w.co_filename)
+    update_code_filenames(space, code_w, pathname)
     exec_code_module(space, w_mod, code_w)
 
     return w_mod
 
-def update_code_filenames(space, code_w, pathname, oldname):
+def update_code_filenames(space, code_w, pathname, oldname=None):
     assert isinstance(code_w, PyCode)
-    if code_w.co_filename != oldname:
+    if oldname is None:
+        oldname = code_w.co_filename
+    elif code_w.co_filename != oldname:
         return
 
     code_w.co_filename = pathname


More information about the Pypy-commit mailing list