This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients alex, belopolsky, eric.snow, jcea, meador.inge, ncoghlan, rfk, rhettinger
Date 2011-11-26.06:41:38
SpamBayes Score 2.54341e-12
Marked as misclassified No
Message-id <1322289699.17.0.851774909669.issue11816@psf.upfronthosting.co.za>
In-reply-to
Content
Somewhat inevitably, the detailed disassembler tests broke when Antoine updated the code generation for function definitions (as part of PEP 3155). (At least, the tests broke, and PEP 3155 seems the most likely culprit).

I subsequently realised there's a potential opportunity here: if Instruction objects define an __eq__ method instead of relying on the custom "assertBytecodeExactlyMatches" helper method the new disassembly tests currently use, then the sequence diffing functionality in unittest could be very helpful in identifying and fixing discrepancies between actual output and expected output.

However, the assertBytecodeExactlyMatches() API has this concept of a "line_offset" which it uses to cope with some of the introspection fodder moving around in the files, so the question then becomes how to deal with that in the context of an __eq__ implementation.

Accordingly, my current plan is to offer "line_offset" as a keyword-only argument to get_instructions() itself. That way, the entire sequence of generated bytecode can easily be adjusted to (for example), be based around the first line being line 1, even if the actual code object being disassembled is located elsewhere in the original source file.
History
Date User Action Args
2011-11-26 06:41:39ncoghlansetrecipients: + ncoghlan, rhettinger, jcea, belopolsky, alex, rfk, meador.inge, eric.snow
2011-11-26 06:41:39ncoghlansetmessageid: <1322289699.17.0.851774909669.issue11816@psf.upfronthosting.co.za>
2011-11-26 06:41:38ncoghlanlinkissue11816 messages
2011-11-26 06:41:38ncoghlancreate