[py-svn] r10509 - py/dist/py/path/local

arigo at codespeak.net arigo at codespeak.net
Sun Apr 10 15:12:03 CEST 2005


Author: arigo
Date: Sun Apr 10 15:12:03 2005
New Revision: 10509

Modified:
   py/dist/py/path/local/local.py
Log:
Check that the .pyc file point to the original .py file.  Ignore it if it
doesn't.


Modified: py/dist/py/path/local/local.py
==============================================================================
--- py/dist/py/path/local/local.py	(original)
+++ py/dist/py/path/local/local.py	Sun Apr 10 15:12:03 2005
@@ -344,7 +344,11 @@
                     if len(header) == 8:
                         magic, timestamp = py.std.struct.unpack('<4si', header)
                         if magic == my_magic and timestamp == my_timestamp:
-                            return py.std.marshal.load(f)
+                            co = py.std.marshal.load(f)
+                            path1 = co.co_filename
+                            path2 = str(self)
+                            if path1 == path2 or os.path.samefile(path1, path2):
+                                return co
                 finally:
                     f.close()
             except py.error.Error:



More information about the pytest-commit mailing list