summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compile.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-44622: Set line number of END_ASYNC_FOR to match that of iterator. ↵Mark Shannon2021-07-151-1/+11
| | | | | (GH-27160) (GH-27163) (cherry picked from commit f333ab0f2edec26a769ed558263ac662e5475451)
* bpo-44297: Fix missing line number in generator expressions (GH-26821)Mark Shannon2021-06-211-0/+15
| | | | | * Make sure that line number is set when entering comprehension scope in compiler. (cherry picked from commit 82e5c28af7049c4f5343c808f172cbe2e145f49b)
* bpo-43833: Emit warnings for numeric literals followed by keyword (GH-25466)Miss Islington (bot)2021-06-081-1/+1
| | | | | | | | | | | Emit a deprecation warning if the numeric literal is immediately followed by one of keywords: and, else, for, if, in, is, or. Raise a syntax error with more informative message if it is immediately followed by other keyword or identifier. Automerge-Triggered-By: GH:pablogsal (cherry picked from commit 2ea6d890281c415e0a2f00e63526e592da8ce3d9) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-42609: Check recursion depth in the AST validator and optimizer (GH-23744)Serhiy Storchaka2021-04-251-7/+12
|
* bpo-43846: Use less stack for large literals and calls (GH-25403)Mark Shannon2021-04-151-0/+26
| | | | | | | | | * Modify compiler to reduce stack consumption for large expressions. * Add more tests for stack usage. * Add NEWS item. * Raise SystemError for truly excessive stack use.
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25145)Inada Naoki2021-04-041-1/+1
| | | | | | | | | | | | | | | | | | | * test_asyncio * test_bz2 * test_math * test_cmath * test_cmd_line * test_cmd_line_script * test_compile * test_contextlib * test_profile * ctypes/test/test_find * test_multiprocessing * test_configparser * test_csv * test_dbm_dumb * test_decimal * test_difflib * os.fdopen() calls io.text_encoding() to emit EncodingWarning for right place.
* Mark POP_TOP at end of expression statement as artificial, to conform to PEP ↵Mark Shannon2021-03-151-0/+8
| | | | 626. (GH-24860)
* bpo-39316: Make sure that attribute accesses and stores, including method ↵Mark Shannon2021-03-141-0/+45
| | | | calls, conform to PEP 626. (GH-24859)
* bpo-42217: compiler: merge same co_code and co_linetable objects (GH-23056)Inada Naoki2021-02-101-0/+11
|
* bpo-42615: Delete redundant jump instructions that only bypass empty blocks ↵Om G2020-12-161-0/+28
| | | | | | | | | | | | | | | | | | | | | | | (GH-23733) * Delete jump instructions that bypass empty blocks * Add news entry * Explicitly check for unconditional jump opcodes Using the is_jump function results in the inclusion of instructions like returns for which this optimization is not really valid. So, instead explicitly check that the instruction is an unconditional jump. * Handle conditional jumps, delete jumps gracefully * Ensure b_nofallthrough and b_reachable are valid * Add test for redundant jumps * Regenerate importlib.h and edit Misc/ACKS * Fix bad whitespace
* bpo-42246: Remove DO_NOT_EMIT_BYTECODE macros, so that while loops and if ↵Mark Shannon2020-12-151-4/+4
| | | | statements conform to PEP 626. (GH-23743)
* bpo-42246: Don't forget the entry block when ensuring that all exits have a ↵Mark Shannon2020-12-041-0/+18
| | | | | line number (GH-23636) Don't forget the entry block when ensuring that all exits have a line number.
* bpo-42246: Make sure that line number is correct after a return, as required ↵Mark Shannon2020-12-021-1/+34
| | | | | 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-0/+24
| | | Make sure that CFG from compiler front-end is correct. Be a bit more aggressive in the compiler back-end.
* bpo-42246: Partial implementation of PEP 626. (GH-23113)Mark Shannon2020-11-121-2/+2
| | | * Implement new line number table format, as defined in PEP 626.
* bpo-41531: Fix compilation of dict literals with more than 0xFFFF elements ↵Pablo Galindo2020-08-131-0/+10
| | | | (GH-21850)
* bpo-40275: Use new test.support helper submodules in tests (GH-21151)Hai Shi2020-06-251-1/+3
| | | | | | | | | | | | | Use new test.support helper submodules in tests: * distutils tests * test_buffer * test_compile * test_filecmp * test_fileinput * test_readline * test_smtpnet * test_structmembers * test_tools
* bpo-40334: Disallow invalid single statements in the new parser (GH-19774)Lysandros Nikolaou2020-04-291-1/+0
| | | | | After parsing is done in single statement mode, the tokenizer buffer has to be checked for additional lines and a `SyntaxError` must be raised, in case there are any. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-40334: Rename PyConfig.use_peg to _use_peg_parser (GH-19670)Victor Stinner2020-04-231-1/+1
| | | | | | | | | | | * Rename PyConfig.use_peg to _use_peg_parser * Document PyConfig._use_peg_parser and mark it a deprecated * Mark -X oldparser option and PYTHONOLDPARSER env var as deprecated in the documentation. * Add use_old_parser() and skip_if_new_parser() to test.support * Remove sys.flags.use_peg: use_old_parser() uses _testinternalcapi.get_configs() instead. * Enhance test_embed tests * subprocess._args_from_interpreter_flags() copies -X oldparser
* bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)Pablo Galindo2020-04-221-0/+1
| | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-38640: Allow break and continue in always false while loops (GH-16992)Pablo Galindo2019-10-301-0/+18
|
* bpo-37500: Make sure dead code does not generate bytecode but also detect ↵Pablo Galindo2019-07-151-0/+34
| | | | | | | | | | | | syntax errors (GH-14612) https://bugs.python.org/issue37500 Add a new field to the compiler structure that allows to be configured so no bytecode is emitted. In this way is possible to detect errors by walking the nodes while preserving optimizations. https://bugs.python.org/issue37500
* bpo-34100: compile: Re-enable frozenset merging (GH-10760)INADA Naoki2018-11-281-0/+8
| | | This reverts commit 1005c84535191a72ebb7587d8c5636a065b7ed79.
* bpo-34100: Partially revert merge_consts_recursive() (GH-10743)Victor Stinner2018-11-271-10/+0
| | | | | Partically revert commit c2e1607a51d7a17f143b5a34e8cff7c6fc58a091 to fix a reference leak.
* bpo-34100: Merge constants recursively (GH-8341)INADA Naoki2018-11-261-0/+10
| | | | | | | There are some same consts in a module. This commit merges them into single instance. It reduces number of objects in memory after loading modules. https://bugs.python.org/issue34100
* bpo-35193: Fix an off by one error in the RETURN_VALUE case. (GH-10418)Gregory P. Smith2018-11-091-0/+19
| | | | | | | | | | | | Fix an off by one error in the peephole optimizer when checking for unreachable code beyond a return. Do a bounds check within find_op so it can return before going past the end as a safety measure. https://github.com/python/cpython/commit/7db3c488335168993689ddae5914a28e16188447#diff-a33329ae6ae0bb295d742f0caf93c137 introduced this off by one error while fixing another one nearby. This bug was shipped in all Python 3.6 and 3.7 releases. The included unittest won't fail unless you do a clang msan build.
* bpo-35133: Fix mistakes when concatenate string literals on different lines. ↵Serhiy Storchaka2018-11-051-1/+1
| | | | | | | | | | (GH-10284) Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings.
* bpo-32489: Allow 'continue' in 'finally' clause. (GH-5822)Serhiy Storchaka2018-03-181-1/+3
|
* bpo-32964: Reuse a testing implementation of the path protocol in tests. (#5930)Serhiy Storchaka2018-03-021-8/+2
|
* bpo-31113: Get rid of recursion in the compiler for normal control flow. (#3015)Serhiy Storchaka2018-01-111-0/+5
|
* bpo-24340: Fix estimation of the code stack size. (#5076)Serhiy Storchaka2018-01-091-1/+290
|
* bpo-27169: The __debug__ constant is now optimized out at compile time. (#4880)Serhiy Storchaka2017-12-151-0/+1
| | | This fixes also bpo-22091.
* Issue #29337: Fixed possible BytesWarning when compare the code objects.Serhiy Storchaka2017-01-241-0/+3
|\ | | | | | | Warnings could be emitted at compile time.
| * Issue #29337: Fixed possible BytesWarning when compare the code objects.Serhiy Storchaka2017-01-241-0/+3
| |\ | | | | | | | | | Warnings could be emitted at compile time.
| | * Issue #29337: Fixed possible BytesWarning when compare the code objects.Serhiy Storchaka2017-01-241-0/+3
| | | | | | | | | | | | Warnings could be emitted at compile time.
* | | Issue #18896: Python function can now have more than 255 parameters.Serhiy Storchaka2016-12-161-9/+2
|/ / | | | | | | collections.namedtuple() now supports tuples with more than 255 elements.
* | Issue #27182: Add support for path-like objects to PyUnicode_FSDecoder().Brett Cannon2016-09-071-0/+10
| |
* | Issue #26754: Undocumented support of general bytes-like objectsSerhiy Storchaka2016-08-061-2/+5
|/ | | | as path in compile() and similar functions is now deprecated.
* Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded asSerhiy Storchaka2016-06-181-0/+7
| | | | an iterable of integers. Now only strings and byte-like objects are accepted.
* code_richcompare() now uses the constants typesVictor Stinner2016-01-221-0/+82
| | | | | | | | | Issue #25843: When compiling code, don't merge constants if they are equal but have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now correctly compiled to two different functions: f1() returns 1 (int) and f2() returns 1.0 (int), even if 1 and 1.0 are equal. Add a new _PyCode_ConstantKey() private function.
* Issue #25388: Fixed tokenizer crash when processing undecodable source codeSerhiy Storchaka2015-11-141-0/+10
|\ | | | | | | with a null byte.
| * Issue #25388: Fixed tokenizer crash when processing undecodable source codeSerhiy Storchaka2015-11-141-0/+10
| | | | | | | | with a null byte.
* | Issue #24802: Update test case for ValueError in 3.5Martin Panter2015-11-081-3/+2
| |
* | Issue #24802: Merge null termination fixes from 3.4 into 3.5Martin Panter2015-11-071-0/+21
|\ \ | |/
| * Issue #24802: Copy bytes-like objects to null-terminated buffers if necessaryMartin Panter2015-11-071-0/+21
| | | | | | | | | | | | | | | | This avoids possible buffer overreads when int(), float(), compile(), exec() and eval() are passed bytes-like objects. Similar code is removed from the complex() constructor, where it was not reachable. Patch by John Leitch, Serhiy Storchaka and Martin Panter.
* | Issue #19235: Add new RecursionError exception. Patch by Georg Brandl.Yury Selivanov2015-07-031-1/+1
| |
* | in dict displays, evaluate the key before the value (closes #11205)Benjamin Peterson2015-05-281-0/+11
| | | | | | | | Patch partially by Steve Dougherty.
* | Fix remaining tests and remove an unused import.Berker Peksag2015-05-061-1/+2
| |
* | merge 3.4 (#24022)Benjamin Peterson2015-04-211-1/+13
|\ \ | |/
| * do not call into python api if an exception is set (#24022)Benjamin Peterson2015-04-211-1/+13
| |