Bugs item #1180193, was opened at 2005-04-10 13:10
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1180193&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Armin Rigo (arigo)
Assigned to: Nobody/Anonymous (nobody)
Summary: broken pyc files

Initial Comment:
In a number of situations, the .pyc files can become "corrupted" in a subtle 
way: the co_filename attribute of the code objects it contains become wrong.  
This can occur if we move or rename directories, or if we access the same set 
of files from two different locations (e.g. over NFS).

This corruption doesn't prevent the .pyc files from working, but the 
interpreter looses the reference to the source file.  It causes trouble in 
tracebacks, in the inspect module, etc.

A simple fix would be to use the following logic when importing a .py file: if 
there is a corresponding .pyc file, in addition to checking the timestamp, 
check the co_filename attribute of the loaded object.  If it doesn't point to 
the original .py file, discard the code object and ignore the .pyc file.

Alternatively, we could force all co_filenames to point to the .py file when 
loading the .pyc file.

I'll write a patch for whichever alternative seems better.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1180193&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to