summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_dis.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-44840: Compiler: Move duplication of exit blocks with no line numbers to ↵Mark Shannon2021-08-091-51/+51
| | | | | after CFG optimization. (GH-27656) (#27673) (cherry picked from commit b854557b49083d8625a433eb36aacb0c87d67c52)
* bpo-44626: Merge basic blocks earlier to enable better handling of exit ↵Mark Shannon2021-07-161-5/+19
| | | | | blocks without line numbers (GH-27138) (GH-27182) (cherry picked from commit a86f7dae0acf918d54086cb85e5a0b0bedeedce7)
* bpo-43933: Set frame.f_lineno during call to __exit__ (GH-25719)Mark Shannon2021-04-301-1/+1
| | | * Set line number of __exit__ call in a with statement to be that of the with keyword.
* bpo-42739: Don't use sentinels to mark end of line table. (GH-25657)Mark Shannon2021-04-291-1/+1
| | | | | * Add length parameter to PyLineTable_InitAddressRange and doen't use sentinel values at end of table. Makes the line number table more robust. * Update PyCodeAddressRange to match PEP 626.
* bpo-38605: Revert making 'from __future__ import annotations' the default ↵Pablo Galindo2021-04-211-18/+20
| | | | | | (GH-25490) This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.
* bpo-27129: Use instruction offsets, not byte offsets, in bytecode and ↵Mark Shannon2021-04-011-30/+30
| | | | | | | internally. (GH-25069) * Use instruction offset, rather than bytecode offset. Streamlines interpreter dispatch a bit, and removes most EXTENDED_ARGs for jumps. * Change some uses of PyCode_Addr2Line to PyFrame_GetLineNumber
* bpo-42908: Mark cleanup code at end of try-except and with artificial (#24202)Mark Shannon2021-01-131-1/+1
| | | | | | | | | * Mark bytecodes at end of try-except as artificial. * Make sure that the CFG is consistent throughout optimiization. * Extend line-number propagation logic so that implicit returns after 'try-except' or 'with' have the correct line numbers. * Update importlib
* bpo-42246: Don't eliminate jumps to jumps, if it will break PEP 626. (GH-23896)Mark Shannon2020-12-231-84/+85
|
* bpo-42634: Mark reraise after except blocks as artificial. (GH-23877)Mark Shannon2020-12-211-37/+37
| | | | | | | * Mark reraise after except blocks as artificial. * Update importlib * Update dis test.
* bpo-42199: Fix bytecode_helper assertNotInBytecode (#23031)Max Bernstein2020-12-181-0/+19
| | | | | | | | | | * bpo-42199: Fix bytecode_helper assertNotInBytecode Add tests. * 📜🤖 Added by blurb_it. Co-authored-by: Dino Viehland <dinoviehland@fb.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-42246: Make sure that `f_lasti`, and thus `f_lineno`, is set correctly ↵Mark Shannon2020-12-171-7/+7
| | | | | | | | | after raising or reraising an exception (GH-23803) * Ensure that f_lasti is set correctly after an exception is raised to conform to PEP 626. * Update importlib * Add NEWS.
* bpo-42645: Make sure that return/break/continue are only traced once when ↵Mark Shannon2020-12-161-12/+4
| | | | | | | | | exiting via a finally block. (GH-23780) * Make sure that return/break/continue are only traced once when exiting via a finally block. * Add test for return in try-finally. * Update importlib
* bpo-42246: Remove DO_NOT_EMIT_BYTECODE macros, so that while loops and if ↵Mark Shannon2020-12-151-66/+71
| | | | statements conform to PEP 626. (GH-23743)
* bpo-42562: Fix issue when dis failed to parse function that has no line ↵Yurii Karabas2020-12-041-0/+17
| | | | | | numbers (GH-23632) Fix issue when dis failed to parse function that has only annotations
* bpo-42246: Make sure that line number is correct after a return, as required ↵Mark Shannon2020-12-021-4/+8
| | | | | by PEP 626 (GH-23495) Make sure that line number is correct after a return, as defined by PEP 626.
* bpo-42349: Compiler clean up. More yak-shaving for PEP 626. (GH-23267)Mark Shannon2020-11-171-24/+25
| | | Make sure that CFG from compiler front-end is correct. Be a bit more aggressive in the compiler back-end.
* bpo-42246: Eliminate jumps to exit blocks by copying those blocks. (#23251)Mark Shannon2020-11-121-116/+113
| | | * Compiler: eliminate jumps to short exit blocks by copying.
* bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)Batuhan Taskaya2020-10-061-20/+18
| | | | | The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions. For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
* bpo-41323: Perform 'peephole' optimizations directly on the CFG. (GH-21517)Mark Shannon2020-07-301-4/+0
| | | * Move 'peephole' optimizations into compile.c and perform them directly on the CFG.
* bpo-39156: Break up COMPARE_OP into four logically distinct opcodes. (GH-17754)Mark Shannon2020-01-141-71/+70
| | | | | | | | Break up COMPARE_OP into four logically distinct opcodes: * COMPARE_OP for rich comparisons * IS_OP for 'is' and 'is not' tests * CONTAINS_OP for 'in' and 'is not' tests * JUMP_IF_NOT_EXC_MATCH for checking exceptions in 'try-except' statements.
* Fix handling of line numbers around finally-blocks. (#17737)Mark Shannon2019-12-301-0/+66
|
* Produce cleaner bytecode for 'with' and 'async with' by generating separate ↵Mark Shannon2019-11-211-33/+54
| | | | | | code for normal and exceptional paths. (#6641) Remove BEGIN_FINALLY, END_FINALLY, CALL_FINALLY and POP_FINALLY bytecodes. Implement finally blocks by code duplication. Reimplement frame.lineno setter using line numbers rather than bytecode offsets.
* bpo-18578: Rename and document test.bytecode_helper as ↵Joannah Nanjekye2019-09-121-1/+1
| | | | | test.support.bytecode_helper (GH-15168) Rename and document test.bytecode_helper as test.support.bytecode_helper
* bpo-34880: Add the LOAD_ASSERTION_ERROR opcode. (GH-15073)Zackery Spytz2019-08-251-1/+1
| | | | Fix assert statement misbehavior if AssertionError is shadowed.
* bpo-37830: Fix compilation of break and continue in finally. (GH-15320)Serhiy Storchaka2019-08-241-4/+4
| | | | | | Fix compilation of "break" and "continue" in the "finally" block when the corresponding "try" block contains "return" with a non-constant value.
* bpo-37122: Make co->co_argcount represent the total number of positonal ↵Pablo Galindo2019-06-011-1/+1
| | | | arguments in the code object (GH-13726)
* bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-291-27/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains the implementation of PEP570: Python positional-only parameters. * Update Grammar/Grammar with new typedarglist and varargslist * Regenerate grammar files * Update and regenerate AST related files * Update code object * Update marshal.c * Update compiler and symtable * Regenerate importlib files * Update callable objects * Implement positional-only args logic in ceval.c * Regenerate frozen data * Update standard library to account for positional-only args * Add test file for positional-only args * Update other test files to account for positional-only args * Add News entry * Update inspect module and related tests
* bpo-12458: Fix line numbers for multiline expressions. (GH-8774)Serhiy Storchaka2018-09-171-2/+6
|
* bpo-33041: Rework compiling an "async for" loop. (#6142)Serhiy Storchaka2018-03-231-2/+1
| | | | | | | | * Added new opcode END_ASYNC_FOR. * Setting global StopAsyncIteration no longer breaks "async for" loops. * Jumping into an "async for" loop is now disabled. * Jumping out of an "async for" loop no longer corrupts the stack. * Simplify the compiler.
* bpo-32970: Improve disassembly of the MAKE_FUNCTION instruction. (GH-5937)Serhiy Storchaka2018-03-111-4/+4
|
* bpo-17611. Move unwinding of stack for "pseudo exceptions" from interpreter ↵Serhiy Storchaka2018-02-221-124/+123
| | | | | | | | | to compiler. (GH-5006) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Antoine Pitrou <antoine@python.org>
* bpo-32550. Remove the STORE_ANNOTATION bytecode. (GH-5181)Mark Shannon2018-01-301-17/+21
|
* bpo-24340: Fix estimation of the code stack size. (#5076)Serhiy Storchaka2018-01-091-8/+8
|
* bpo-31183: `dis` now handles coroutines & async generators (GH-3077)syncosmic2017-08-181-5/+27
| | | | | | | | | | | | | | Coroutines and async generators use a distinct attribute name for their code objects, so this updates the `dis` module to correctly disassemble objects with those attributes. Due to the increase in the test module length, it also fixes some latent defects in the tests related to how the displayed source line numbers are extracted. https://bugs.python.org/issue31230 is a follow-up issue suggesting we may want to solve this a different way, by instead giving all these object types a common `__code__` attribute, avoiding the need for special casing in the `dis` module.
* bpo-11822: Improve disassembly to show embedded code objects. (#1844)Serhiy Storchaka2017-06-111-7/+82
| | | The depth argument limits recursion.
* bpo-22352: Adjust widths in the output of dis.dis() for large line numbers ↵Serhiy Storchaka2017-04-191-1/+51
| | | | | | | and (#1153) instruction offsets. Add tests for widths of opcode names.
* Remove unused imports.Serhiy Storchaka2016-12-161-1/+0
|
* Issue #28317: The disassembler now decodes FORMAT_VALUE argument.Serhiy Storchaka2016-10-081-0/+24
|
* Rework CALL_FUNCTION* opcodesVictor Stinner2016-09-091-18/+18
| | | | | | | | | | | | | | | | | | | Issue #27213: Rework CALL_FUNCTION* opcodes to produce shorter and more efficient bytecode: * CALL_FUNCTION now only accepts position arguments * CALL_FUNCTION_KW accepts position arguments and keyword arguments, but keys of keyword arguments are packed into a constant tuple. * CALL_FUNCTION_EX is the most generic, it expects a tuple and a dict for positional and keyword arguments. CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW opcodes have been removed. 2 tests of test_traceback are currently broken: skip test, the issue #28050 was created to track the issue. Patch by Demur Rumed, design by Serhiy Storchaka, reviewed by Serhiy Storchaka and Victor Stinner.
* Issue #28003: Implement PEP 525 -- Asynchronous Generators.Yury Selivanov2016-09-091-1/+1
|
* Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.Yury Selivanov2016-09-091-0/+33
| | | | Patch by Ivan Levkivskyi.
* Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes.Serhiy Storchaka2016-06-121-41/+39
| | | | Patch by Demur Rumed.
* Issue #26647: Python interpreter now uses 16-bit wordcode instead of bytecode.Serhiy Storchaka2016-05-241-262/+262
| | | | Patch by Demur Rumed.
* Issue #26733: Disassembling a class now disassembles class and static methods.Serhiy Storchaka2016-04-231-2/+50
| | | | Patch by Xiang Zhang.
* Issue #26733: Fixed formatting line numbers in test_dis.Serhiy Storchaka2016-04-121-11/+11
| | | | Based on patch by Xiang Zhang.
* PEP 0492 -- Coroutines with async and await syntax. Issue #24017.Yury Selivanov2015-05-121-13/+33
|
* Issue #21741: Update 147 test modules to use test discovery.Zachary Ware2015-04-131-1/+1
| | | | | | | I have compared output between pre- and post-patch runs of these tests to make sure there's nothing missing and nothing broken, on both Windows and Linux. The only differences I found were actually tests that were previously *not* run.
* merge 3.4 (#23048)Benjamin Peterson2014-12-131-3/+4
|\
| * pop the loop block even for infinite while loops (closes #23048)Benjamin Peterson2014-12-131-3/+4
| |
* | Closes #11471: avoid generating a JUMP_FORWARD instruction at the end of an ↵Antoine Pitrou2014-09-181-88/+84
| | | | | | | | | | | | if-block if there is no else-clause. Original patch by Eugene Toder.