[issue15030] PyPycLoader can't read cached .pyc files

Marc Abramowitz report at bugs.python.org
Wed Jun 27 07:36:58 CEST 2012


Marc Abramowitz <msabramo at gmail.com> added the comment:

Attaching a patch...

Using Ronan's test_PyPyc.diff, before my patch:

{{{
~/dev/hg-repos/cpython$ ./python.exe -m unittest Lib/importlib/test/source/test_abc_loader.py 
...........................................E..................
======================================================================
ERROR: test_pyc_compatibility (Lib.importlib.test.source.test_abc_loader.RegeneratedBytecodeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./Lib/importlib/test/source/util.py", line 23, in wrapper
    to_return = fxn(*args, **kwargs)
  File "./Lib/importlib/test/source/test_abc_loader.py", line 473, in test_pyc_compatibility
    mock.load_module(name)
  File "<frozen importlib._bootstrap>", line 760, in load_module
  File "<frozen importlib._bootstrap>", line 408, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 636, in _load_module
  File "./Lib/importlib/test/source/test_abc_loader.py", line 201, in get_code
    code_object = super().get_code(name)
  File "/Users/marca/dev/hg-repos/cpython/Lib/importlib/abc.py", line 305, in get_code
    return marshal.loads(bytecode)
ValueError: bad marshal data (unknown type code)

----------------------------------------------------------------------
Ran 62 tests in 0.076s

FAILED (errors=1)
[114118 refs]
}}}

After my patch:

{{{
~/dev/hg-repos/cpython$ patch -p1 < ~/Desktop/cpython-issue-15030.patch 
patching file Lib/importlib/abc.py
~/dev/hg-repos/cpython$ ./python.exe -m unittest Lib/importlib/test/source/test_abc_loader.py 
..............................................................
----------------------------------------------------------------------
Ran 62 tests in 0.079s

OK
[114118 refs]
}}}

----------
nosy: +Marc.Abramowitz
Added file: http://bugs.python.org/file26173/cpython-issue-15030.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15030>
_______________________________________


More information about the Python-bugs-list mailing list