Commit Graph
86 Commits
Author SHA1 Message Date
Marc MuellerandPieter Eendebak 972cfaae3f gh-138912: Add fast path for match class patterns without sub-patterns (#144820)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2026-09-26 13:00:10 -07:00
Marc Mueller 109a192eb5 gh-151907: Reduce duplication in codegen comprehension functions (GH-154846) 2026-09-26 12:49:38 -04:00
Irit Katriel a9d42dceee gh-124697: Represent inlined comprehensions as subscopes in the symbol table (#156819) 2026-09-23 20:31:57 +01:00
Peter Gessler f8b0e26a6a gh-150737: Optimize bytecode for empty unpack cases such as `{*()}`. (#150812) 2026-09-20 21:53:10 -07:00
Irit Katriel 14a93f4d91 gh-156091: Fix crash compiling deeply nested inlined comprehensions (#156957) 2026-09-05 16:01:05 +00:00
Irit Katriel e56f86fb6c gh-143493: fix cleanup on errors in codegen_comprehension (#156374) 2026-09-04 17:15:44 +00:00
cui fliter e13ecaeca2 gh-155141: Improve stack-use estimation for keyword calls (#155785) 2026-09-03 13:06:35 +00:00
Irit Katriel 41b3f0af26 gh-156466: fix cleanup on error after Enter in codegen_enter_scope (#156467) 2026-08-29 22:40:37 +01:00
Irit Katriel d94c4ad1b6 gh-156466: fix cleanup on error in codegen_function_body (#156511) 2026-08-29 15:01:55 +01:00
Irit Katriel 8b082aa405 gh-156459: Fix cleanup on error in compiler_set_qualname (#156462) 2026-08-29 12:22:25 +00:00
Jelle Zijlstra f4874f381c gh-156466: Fix additional compiler scope cleanup errors (#156547) 2026-08-29 13:14:29 +01:00
Irit Katriel 683ef4082d gh-156466: fix cleanup on error in codegen_class_body (#156507) 2026-08-28 21:01:47 +00:00
Irit Katriel 8e0159bd23 gh-156466: fix cleanup on error in codegen_leave_annotations_scope (#156497) 2026-08-28 15:03:56 +01:00
Irit Katriel 0e29768493 gh-156466: fix cleanup on error in codegen_function_annotations (#156502) 2026-08-28 11:25:52 +01:00
Irit Katriel 24e5a55ccb gh-156466: fix cleanup on error in codegen_setup_annotations_scope (#156473) 2026-08-27 21:11:05 +01:00
Timofei Ivankovandsobolevn dd5a285387 gh-154902: Add an intrinsic for conditional annotations (#155026)
Co-authored-by: sobolevn <mail@sobolevn.me>
2026-08-05 07:26:20 -07:00
Peter BiermaandIrit Katriel a78589851b gh-151907: Avoid creating temporary objects in some list comprehensions (GH-151908)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2026-07-14 11:06:29 -04:00
An Long 8bee2a39b8 gh-145855: Remove the DELETE_ATTR bytecode (GH-146216) 2026-07-06 10:41:47 +01:00
Brij Kapadia a3dc7849a3 gh-145857: Replace DELETE_GLOBAL with PUSH_NULL; STORE_GLOBAL (GH-146314) 2026-06-30 19:04:56 +01:00
Brij Kapadia c393ab61d9 gh-145854: Replace DELETE_NAME with PUSH_NULL; STORE_NAME (GH-146006) 2026-06-30 17:21:31 +01:00
Timofei 7782794850 gh-151665: Fix inspect.signature() on type alias and type parameter evaluators (#151837) 2026-06-21 15:08:01 -07:00
Peter Bierma 409fa8e1f3 gh-150027: Avoid copying during construction of frozenset objects (GH-150028) 2026-05-19 13:57:37 -04:00
Mark Shannon 70bd1c2dd2 GH-143732: SEND specialization (GH-148963)
* SEND specialization. Adds 2 new specialized instructions:

* SEND_VIRTUAL: for sends to virtual iterators e.g lists and tuples
* SEND_ASYNC_GEN: for sends to async generators

Tweak FOR_ITER_VIRTUAL so that SEND_VIRTUAL and FOR_ITER_VIRTUAL use equivalent guards
2026-05-05 15:19:16 +01:00
Petr Viktorin 4599335a83 gh-149122: Fix refleak in codegen (GH-149179) 2026-04-30 10:05:48 +00:00
Irit Katriel 16f292ef4e gh-149122: Fix segfault in compiler when certain builtin functions are passed a coroutine as arg (#149138) 2026-04-29 13:35:51 +00:00
Mark Shannon 600f4dbd54 GH-145668: Add FOR_ITER specialization for virtual iterators. Specialize GET_ITER. (GH-147967)
* Add FOR_ITER_VIRTUAL to specialize FOR_ITER for virtual iterators
* Add GET_ITER_SELF to specialize GET_ITER for iterators (including generators)
* Add GET_ITER_VIRTUAL to specialize GET_ITER for iterables as virtual iterators
* Add new (internal) _tp_iteritem function slot to PyTypeObject
* Put limited RESUME at start of genexpr for free-threading. Fix up exception handling in genexpr
2026-04-16 15:22:22 +01:00
Carey Metcalfe cb339d3c9e gh-143886: Ensure function annotations are returned in order of definition (#143888)
Ensure function annotations are returned in order of definition

Previously, when getting type annotations of a function, normal
arguments were returned before positional-only ones in the dictionary.
Since `functools.singledispatch` relies on this ordering being correct
to dispatch based on the type of the first argument, this issue was
causing incorrect registrations for functions with positional-only
arguments.

This commit updates how annotations are generated so that
positional-only arguments are generated and added to the dictionary
before normal arguments.
2026-04-15 06:24:28 -07:00
Brandon ca95e979d6 gh-146442: Fix various bugs in compiler pipeline (#146443)
Fix null derefs, missing decrefs, and unchecked returns from bug report.
2026-03-30 22:04:04 +02:00
Mark Shannon 879c85f6e4 GH-145667: Merge GET_ITER and GET_YIELD_FROM_ITER (GH-146120)
* Merge GET_ITER and GET_YIELD_FROM_ITER. Modify SEND to make it a bit more like FOR_ITER
2026-03-21 10:48:13 +00:00
Stan Ulbrych 5e61a16c10 gh-145187: Fix crash on invalid type parameter bound expression in conditional block (GH-145188)
Fix parsing crash found by oss-fuzz
2026-02-24 12:44:57 -08:00
Benedikt Johannes 645f5c4a73 gh-144822: remove redundant decref in codegen.c (#144823) 2026-02-14 19:20:33 +00:00
46d5106cfa gh-142349: Implement PEP 810 - Explicit lazy imports (#142351)
Co-authored-by: T. Wouters <twouters@meta.com >
Co-authored-by: Brittany Reynoso <breynoso@meta.com>
Co-authored-by: Dino Viehland <dinoviehland@meta.com>
2026-02-12 00:15:33 +00:00
adam j hartzandJelle Zijlstra ccbe41e27c gh-143055: Implementation of PEP 798 (#143056)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-01-30 20:37:52 -08:00
Mark Shannon ae53da5758 GH-143493: Conform to spec for generator expressions while supporting virtual iterators (GH-143569)
* Moves the `GET_ITER` instruction into the generator function preamble.
  This means the the iterable is converted into an iterator during generator
  creation, as documented, but keeps it in the same code object allowing
  optimization.
2026-01-16 09:11:58 +00:00
Kumar Aditya 74bb3ca1f8 gh-142863: optimize list and set calls with generator expressions (#142864) 2026-01-06 23:23:28 +05:30
Jelle Zijlstra 7a6fd4a45d gh-138349: Fix crash when combining module-level annotation and listcomp (#138363) 2025-09-10 15:18:39 +02:00
Dino Viehland 04c7f36205 gh-138230: Remove dead code in code gen - codegen_check_annotation is only calle… (#138228)
Remove dead code in code gen - codegen_check_annotation is only called if future annotations are enabled, and if future annotations are enabled it does nothing.
2025-09-09 18:17:00 -07:00
Brian Schubert 5493b46462 gh-138372: Fix SyntaxWarning for erroneous t-string subscription (#138375) 2025-09-02 18:13:12 +01:00
c5e77af131 gh-132661: Disallow Template/str concatenation after PEP 750 spec update (#135996)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2025-07-21 08:44:26 +02:00
Petr Viktorin 1b1ae82fab gh-135755: Move SPECIAL_ constants to a private header (GH-135922)
Macros without a `Py`/`_Py` prefix should not be defined in public headers.
2025-06-25 13:03:05 +02:00
Mark Shannon f6f4e8a662 GH-132554: "Virtual" iterators (GH-132555)
* FOR_ITER now pushes either the iterator and NULL or leaves the iterable and pushes tagged zero

* NEXT_ITER uses the tagged int as the index into the sequence or, if TOS is NULL, iterates as before.
2025-05-27 15:59:45 +01:00
Nybblista 20f8ed595d gh-133279: Assert with HAS_TARGET in the codegen_addop_j function (#133280) 2025-05-02 13:52:48 +01:00
60202609a2 gh-132661: Implement PEP 750 (#132662)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Wingy <git@wingysam.xyz>
Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Paul Everitt <pauleveritt@me.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-30 11:46:41 +02:00
Jelle Zijlstra 922049b613 gh-130907: Treat all module-level annotations as conditional (#131550) 2025-04-28 06:10:28 -07:00
Mark Shannon d87e7f3529 GH-127682: Only call __iter__ once in generator expressions. (GH-132351) 2025-04-11 09:37:22 +01:00
Jelle Zijlstra 07b8d3117f gh-132261: Store annotations at hidden internal keys in the class dict (#132345) 2025-04-10 21:13:26 -07:00
Irit Katriel 2c8f329dc6 gh-131738: optimize builtin any/all/tuple calls with a generator expression arg (#131737) 2025-03-28 10:35:20 +00:00
Jelle Zijlstra 898e6b395e gh-130881: Handle conditionally defined annotations (#130935) 2025-03-26 03:48:19 +00:00
Yan Yanchii 75103d975c gh-126835: Move constant tuple folding from ast_opt to CFG (#130769) 2025-03-19 20:59:55 +00:00
Mark Shannon a45f25361d GH-131238: More refactoring of core header files (GH-131351)
Adds new pycore_stats.h header file to help break dependencies involving the pycore_code.h header.
2025-03-17 14:41:05 +00:00