summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-98442: fix locations of with statement's cleanup instructions ↵Miss Islington (bot)2024-09-021-1/+3
| | | | | | | | | | | (GH-120763) (#120786) gh-98442: fix locations of with statement's cleanup instructions (GH-120763) (cherry picked from commit 55596ae0446e40f47e2a28b8897fe9530c32a19a) gh-98442: fix location of with statement's cleanup instructions Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.13] gh-93691: fix too broad source locations of with-statement ↵Miss Islington (bot)2024-09-021-3/+2
| | | | | | | | instructions (GH-120125) (#123604) gh-93691: fix too broad source locations of with-statement instructions (GH-120125) (cherry picked from commit eca3f7762c23b22a73a5e0b09520748c88aab4a0) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.13] gh-123142: fix too wide source location of GET_ITER/GET_AITER ↵Irit Katriel2024-08-281-8/+7
| | | | | (GH-123420). (#123435) (cherry picked from commit 61bef6245c4a32bf430d684ede8603f423d63284)
* [3.13] gh-123142: Fix too wide source locations in tracebacks of exceptions ↵Irit Katriel2024-08-221-2/+3
| | | | | from broken iterables in comprehensions (GH-123173). (#123209) (cherry picked from commit ec89620e5e147ba028a46dd695ef073a72000b84)
* [3.13] gh-123048: Fix missing source location in pattern matching code ↵Miss Islington (bot)2024-08-201-1/+1
| | | | | | | | (GH-123167) (#123169) gh-123048: Fix missing source location in pattern matching code (GH-123167) (cherry picked from commit bffed80230f2617de2ee02bd4bdded1024234dab) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.13] gh-122445: populate only modified fields in __static_attributes__ ↵Irit Katriel2024-08-021-15/+15
| | | | | | | (#122446) (#122621) gh-122445: populate only modified fields in __static_attributes__ (#122446) (cherry picked from commit 498376d7a7d6f704f22a2c963130cc15c17e7a6f)
* [3.13] gh-121657: Display correct error message for yield from outsid… ↵Kirill Podoprigora2024-07-151-1/+1
| | | | | | | | (GH-121768) (cherry picked from commit 178e44de8f023be7a5dc400044ab61983b191f24) Co-authored-by: Gregor <36135323+gege-hoho@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-113993: Allow interned strings to be mortal, and fix related ↵Petr Viktorin2024-06-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | issues (GH-120520) (GH-120945) * Add an InternalDocs file describing how interning should work and how to use it. * Add internal functions to *explicitly* request what kind of interning is done: - `_PyUnicode_InternMortal` - `_PyUnicode_InternImmortal` - `_PyUnicode_InternStatic` * Switch uses of `PyUnicode_InternInPlace` to those. * Disallow using `_Py_SetImmortal` on strings directly. You should use `_PyUnicode_InternImmortal` instead: - Strings should be interned before immortalization, otherwise you're possibly interning a immortalizing copy. - `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to `SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in backports, as they are now part of public API and version-specific ABI. * Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery. * Make sure the statically allocated string singletons are unique. This means these sets are now disjoint: - `_Py_ID` - `_Py_STR` (including the empty string) - one-character latin-1 singletons Now, when you intern a singleton, that exact singleton will be interned. * Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic). * Intern `_Py_STR` singletons at startup. * For free-threaded builds, intern `_Py_LATIN1_CHR` singletons at startup. * Beef up the tests. Cover internal details (marked with `@cpython_only`). * Add lots of assertions Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] gh-120722: Set position on RETURN_VALUE in lambda (GH-120724) (#120738)Miss Islington (bot)2024-06-191-1/+1
| | | | | (cherry picked from commit d8f27cb1141fd3575de816438ed80a916c0560ed) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* [3.13] gh-93691: fix too broad source locations of for statement iterators ↵Miss Islington (bot)2024-06-121-0/+7
| | | | | | | | (GH-120330) (#120399) gh-93691: fix too broad source locations of for statement iterators (GH-120330) (cherry picked from commit 97b69db167be28a33688db436551a6c3c3ea4662) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.13] gh-119311: Fix name mangling with PEP 695 generic classes (#119464) ↵Jelle Zijlstra2024-05-281-6/+6
| | | | | | | | (#119643) Fixes #119311. Fixes #119395. (cherry picked from commit a9a74da4a0ca0645f049e67b6434a95e30592c32)
* gh-118465: Add __firstlineno__ attribute to class (GH-118475)Serhiy Storchaka2024-05-061-0/+5
| | | | It is set by compiler with the line number of the first line of the class definition.
* gh-118513: Fix sibling comprehensions with a name bound in one and global in ↵Carl Meyer2024-05-031-39/+42
| | | | | | the other (#118526) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* gh-116126: Implement PEP 696 (#116129)Jelle Zijlstra2024-05-031-14/+75
| | | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-118216: Don't consider dotted `__future__` imports (#118267)Crowthebird2024-05-021-1/+1
|
* gh-116767: fix crash on 'async with' with many context managers (GH-118348)Irit Katriel2024-05-011-2/+16
| | | | | | | Account for `add_stopiteration_handler` pushing a block for `async with`. To allow generator functions that previously almost hit the `CO_MAXBLOCKS` limit by nesting non-async blocks, the limit is increased by 1. This increase allows one more block in non-generator functions.
* gh-117901: Add option for compiler's codegen to save nested instruction ↵Irit Katriel2024-04-241-0/+18
| | | | sequences for introspection (#118007)
* gh-117680: make _PyInstructionSequence a PyObject and use it in tests (#117629)Irit Katriel2024-04-171-164/+34
|
* gh-117494: extract the Instruction Sequence data structure into a separate ↵Irit Katriel2024-04-041-166/+31
| | | | file (#117496)
* gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private ↵Irit Katriel2024-04-021-4/+4
| | | | (#117412)
* gh-117288: Allocate fewer label IDs in _PyCfg_ToInstructionSequence (#117290)Irit Katriel2024-03-271-4/+30
|
* gh-115775: Compiler adds __static_attributes__ field to classes (#115913)Irit Katriel2024-03-261-1/+53
|
* gh-115756: make PyCode_GetFirstFree an unstable API (GH-115781)Bogdan Romanyuk2024-03-191-1/+1
|
* gh-111789: Use PyDict_GetItemRef() in Python/compile.c (GH-112083)Serhiy Storchaka2024-02-231-5/+4
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-115376: fix segfault in _testinternalcapi.compiler_codegen on bad input ↵Irit Katriel2024-02-151-14/+28
| | | | (#115379)
* gh-115347: avoid emitting redundant NOP for the docstring with -OO (#115494)Irit Katriel2024-02-151-18/+20
|
* gh-112066: Use `PyDict_SetDefaultRef` in place of `PyDict_SetDefault`. (#112211)Sam Gross2024-02-071-12/+17
| | | | | This changes a number of internal usages of `PyDict_SetDefault` to use `PyDict_SetDefaultRef`. Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-114569: Use PyMem_* APIs for non-PyObjects in compiler (#114587)Erlend E. Aasland2024-01-291-13/+12
|
* GH-112354: `END_FOR` instruction to only pop one value. (GH-114247)Mark Shannon2024-01-241-0/+10
| | | | * Compiler emits END_FOR; POP_TOP instead of END_FOR. To support tier 2 side exits in loops.
* gh-107901: synthetic jumps which are not at end of loop no longer check the ↵Irit Katriel2024-01-061-20/+20
| | | | eval breaker (#113721)
* GH-111485: Generate instruction and uop metadata (GH-113287)Mark Shannon2023-12-201-30/+7
|
* gh-99606: Make code generated for an empty f-string identical to that of a ↵Irit Katriel2023-11-261-2/+6
| | | | normal empty string (#112407)
* gh-107149: make new opcode util functions private rather than public and ↵Irit Katriel2023-11-141-8/+8
| | | | unstable (#112042)
* gh-111354: Simplify _PyGen_yf by moving some of its work to the compiler and ↵Irit Katriel2023-11-031-2/+2
| | | | frame state (#111648)
* gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 ↵Irit Katriel2023-11-021-2/+2
| | | | (#111459)
* gh-108082: Use PyErr_FormatUnraisable() (GH-111580)Serhiy Storchaka2023-11-021-3/+2
| | | | | | Replace most of calls of _PyErr_WriteUnraisableMsg() and some calls of PyErr_WriteUnraisable(NULL) with PyErr_FormatUnraisable(). Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-111354: define names for RESUME oparg values (#111365)Irit Katriel2023-10-261-3/+3
|
* gh-105658: fix excess trace events for except block ending with a ↵Irit Katriel2023-09-141-14/+2
| | | | conditional block (#109384)
* GH-105848: Replace KW_NAMES + CALL with LOAD_CONST + CALL_KW (GH-109300)Brandt Bucher2023-09-131-10/+12
|
* gh-109195: fix source location for super load before LOAD_SUPER_ATTR (#109289)Carl Meyer2023-09-111-1/+1
|
* gh-106320: Remove private _PyErr_WriteUnraisableMsg() (#108863)Victor Stinner2023-09-041-0/+1
| | | | | | Move the private _PyErr_WriteUnraisableMsg() functions to the internal C API (pycore_pyerrors.h). Move write_unraisable_exc() from _testcapi to _testinternalcapi.
* gh-108654: restore comprehension locals before handling exception (#108659)Carl Meyer2023-08-301-14/+53
| | | Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* gh-105481: remove regen-opcode. Generated _PyOpcode_Caches in regen-cases. ↵Irit Katriel2023-08-231-0/+1
| | | | (#108367)
* gh-108308: Replace PyDict_GetItem() with PyDict_GetItemRef() (#108309)Victor Stinner2023-08-231-7/+27
| | | | | | | | | Replace PyDict_GetItem() calls with PyDict_GetItemRef() or PyDict_GetItemWithError() to handle errors. * Replace PyLong_AS_LONG() with _PyLong_AsInt() and check for errors. * Check for PyDict_Contains() error. * pycore_init_builtins() checks for _PyType_Lookup() failure.
* gh-108113: Make it possible to optimize an AST (#108282)Irit Katriel2023-08-231-0/+18
|
* gh-105724: Add location information to `assert` errors (GH-105935)Nikita Sobolev2023-08-161-1/+1
|
* gh-106149: move CFG and basicblock definitions into flowgraph.c, use them as ↵Irit Katriel2023-08-101-364/+68
| | | | opaque types in compile.c (#107639)
* GH-105848: Simplify the arrangement of CALL's stack (GH-107788)Brandt Bucher2023-08-091-10/+9
|
* gh-106149: fix comment on stackdepth of generators (#107321)Irit Katriel2023-07-261-2/+3
|
* gh-106149: Simplify stack depth calculation. Replace asserts by exceptions. ↵Irit Katriel2023-07-261-16/+31
| | | | (#107255)