Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1362)

#15030: PyPycLoader can't read cached .pyc files

Can't Edit
Can't Publish+Mail
Start Review
Created:
1 year ago by ronan.lamy
Modified:
11 months, 3 weeks ago
Reviewers:
brett
CC:
loewis, brett.cannon, Georg, jcea, AntoinePitrou, Arfrever.FTA_GMail.Com, Marc.Abramowitz, Ronan.Lamy
Visibility:
Public.

Patch Set 1 #

Total comments: 2

Patch Set 2 #

Total comments: 2

Patch Set 3 #

Patch Set 4 #

Patch Set 5 #

Patch Set 6 #

Total comments: 3

Patch Set 7 #

Patch Set 8 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Misc/ACKS View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 3
brett.cannon
http://bugs.python.org/review/15030/diff/5254/Lib/importlib/abc.py File Lib/importlib/abc.py (right): http://bugs.python.org/review/15030/diff/5254/Lib/importlib/abc.py#newcode308 Lib/importlib/abc.py:308: bytecode = data[12:] # Python 3.3 added file size ...
11 months, 3 weeks ago #1
brett.cannon
Almost there! Very minor tweaks. http://bugs.python.org/review/15030/diff/5258/Lib/importlib/abc.py File Lib/importlib/abc.py (right): http://bugs.python.org/review/15030/diff/5258/Lib/importlib/abc.py#newcode312 Lib/importlib/abc.py:312: return marshal.loads(bytecode) Drop the ...
11 months, 3 weeks ago #2
brett.cannon
11 months, 3 weeks ago #3
There's a bug in the calculation of the file size field and the test is doing
more than it needs to (and I do realize, Marc, that the test is originally from
Ronan and not you).

http://bugs.python.org/review/15030/diff/5266/Lib/importlib/abc.py
File Lib/importlib/abc.py (right):

http://bugs.python.org/review/15030/diff/5266/Lib/importlib/abc.py#newcode326
Lib/importlib/abc.py:326: data.extend(_bootstrap._w_long(len(bytecode)))
It is the length of the source, not the bytecode; see
Lib/importlib/_bootstrap.py:SourceLoader.get_code() for how importlib already
does it.

http://bugs.python.org/review/15030/diff/5266/Lib/importlib/test/source/test_...
File Lib/importlib/test/source/test_abc_loader.py (right):

http://bugs.python.org/review/15030/diff/5266/Lib/importlib/test/source/test_...
Lib/importlib/test/source/test_abc_loader.py:462: name = 'foo'
Module uses 'mod' for the module name in the tests.

http://bugs.python.org/review/15030/diff/5266/Lib/importlib/test/source/test_...
Lib/importlib/test/source/test_abc_loader.py:463: with
source_util.create_modules(name) as fpath:
I think this is the wrong approach. PyPycLoaderMock provides everything
necessary to avoid writing bytecode.  You can make it return bytecode for
get_data() that has the size field to verify it parses it properly, and you can
introspect what write_bytecode() was called with to make sure the field was set.
That way you avoid any writing of files and thus slowing the test down (it still
requires the writes_bytecode_files flag, though, else get_code() won't write the
fake bytecode out).
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7