1. Ranjith Kumar
  2. pypy

Commits

Amaury Forgeot d'Arc  committed 8560e39

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

  • Participants
  • Parent commits f0ac076
  • Branches default

Comments (0)

Files changed (1)

File pypy/module/imp/importing.py

View file
         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