9181 Commits
Author SHA1 Message Date
Miss Islington (bot)andGregory P. Smith 824836b660 [3.13] gh-158446: Reject float format precision near INT_MAX (GH-158474) (#158478)
gh-158446: Reject float format precision near INT_MAX (GH-158474)

Formatting a float or complex with a precision within about 1000 of
INT_MAX could crash or produce incorrect output.
PyOS_double_to_string() now raises ValueError("precision too big") for
such precisions, as the format string parsers already do for
precisions above INT_MAX.

The limit applies regardless of presentation type or value, so a few
calls that previously succeeded (inf, nan, or 'g' with such a
precision) now raise as well.
(cherry picked from commit b7b4f3ecf2)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-09-30 05:47:43 +00:00
Peter BiermaandHimesh Rupchandani 36ebb65e1b [3.13] gh-158364: Don't report other interpreters' threads in sys._current_frames (GH-158369) (GH-158473)
(cherry picked from commit c3cb46870b)

Co-authored-by: Himesh Rupchandani <rupchandanihimesh69@gmail.com>
2026-09-30 02:54:58 +00:00
Cody Maloney 6959d94c01 [3.13] gh-154175: Fetch _PY_GIL_DROP_REQUEST_BIT under GIL (#157013)
gh-154175: Fetch _PY_GIL_DROP_REQUEST_BIT under GIL

Once the GIL is released the tstate may be freed which shows up as ASAN
and TSAN failures in test_io with daemon threads. Check the bit before
dropping the GIL so the tstate is guaranteed to still be allocated.

Remove the TSAN suppressions which were added for 3.13 as this should
fix this case.
2026-09-29 23:24:31 +02:00
Pablo Galindo Salgado 2aed76380b [3.13] gh-156114: Fix crash in perf trampoline with unencodable code names (GH-156300) (#157774) 2026-09-18 21:27:16 +00:00
Irit Katriel bfbd499ff1 [3.13] gh-156466: fix cleanup on error after Enter in codegen_enter_scope (#156615) 2026-09-17 19:15:10 +01:00
Irit KatrielandCursor d7657d0e18 [3.13] gh-156091: Fix crash compiling deeply nested inlined comprehensions (GH-156957) (#157050)
Count inlined-comprehension SETUP_FINALLY handlers toward CO_MAXBLOCKS.
Manual backport of 14a93f4d91 / GH-156993; 3.13 still has this code in compile.c.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 19:14:25 +01:00
Jelle Zijlstra 6b490d5785 [3.13] gh-156466: Fix additional compiler scope cleanup errors (GH-156547) (#156582) 2026-08-29 13:27:54 -07:00
Serhiy Storchaka 7e02d2f469 [3.13] gh-86427: Use the console code page for the stdio encoding on Windows (GH-155415) (GH-156604)
In the legacy Windows stdio mode PyConfig.stdio_encoding is now initialized
with the console output code page instead of the ANSI code page.

Only one encoding can be specified, so sys.stdin.encoding is still wrong if
the input code page differs from the output one.

(cherry picked from commit 0bb312a4ea)
2026-08-29 19:49:44 +00:00
Serhiy Storchaka d9b739040c [3.13] gh-87587: Fix os.device_encoding() for any console on Windows (GH-155410) (GH-156597)
It was hard coded to map file descriptors 0, 1 and 2 to the console code
page, but a console can be opened as any file descriptor, and other
character devices, like NUL, are not consoles.

The file handle is now queried.  The UTF-8 code page is also now reported
as "utf-8" instead of "cp65001".

(cherry picked from commit b4aea41d1c)
2026-08-29 18:42:14 +00:00
Serhiy Storchaka e178a13f2f [3.13] gh-156196: Fix a failed assignment to a PyMemberDef attribute changing its value (GH-156197)
PyMember_SetOne() stored the result of the conversion before checking it
for an error.
2026-08-21 16:00:39 +00:00
stevensandStan Ulbrych 45169108b7 [3.13] gh-155952: Fix <unrepresentable> Argument Clinic defaults in several signatures (#156170)
(cherry picked from commit 5a7fd42138)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-08-21 13:25:13 +01:00
Miss Islington (bot)andSerhiy Storchaka 01189bdaf4 [3.13] gh-123011: Fix warn_explicit() with the globals of the __main__ module (GH-155318) (GH-155991)
The __main__ module executed as a script or a command has __spec__ set to
None, so warn_explicit(module_globals=globals()) emitted a spurious
DeprecationWarning.  It also raised ImportError when the loader was unable
to provide the source of the module: when the module was executed with -m
(the loader can only handle its own module name) or as a command (the
built-in importer has no source).
(cherry picked from commit f2eaf174b2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-08-18 07:50:34 +00:00
Han Lee | 이한결andNeil Schemenauer 6d13dc528b [3.13] gh-155515: Use GC tracking for HAMT iterators (GH-155517) (#155918)
Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2026-08-17 06:48:45 +03:00
Serhiy Storchaka f61481fbec [3.13] gh-155319: Fix the source line of a warning issued with module_globals (GH-155320) (GH-155826)
warn_explicit() computed the source line from the loader of the module
whose globals were passed as module_globals, but did not pass it to
WarningMessage.  It also raised IndexError if lineno was out of the range
of the module source.

(cherry picked from commit c92e2fd8f9)
2026-08-15 07:36:11 +00:00
Serhiy StorchakaandBatuhan Taskaya ca393635a5 [3.13] gh-85260: Extend the AST Validator to validate all identifiers (GH-21069) (GH-155653)
(cherry picked from commit 47e21752b5)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2026-08-13 05:59:34 +00:00
Miss Islington (bot)andstevens 2e19855a17 [3.13] gh-151524: Make it clearer that _PyInstrumentation_DISABLE is immortal in the code (GH-151525) (GH-155351)
(cherry picked from commit 52bed26b79)

Co-authored-by: stevens <lipengyu@kylinos.cn>
2026-08-07 15:52:49 +00:00
Serhiy StorchakaandClaude Opus 4.8 6531253195 [3.13] gh-154283: Make threading.get_native_id() unique across processes on DragonFly (GH-154287) (GH-154298)
On DragonFly BSD lwp_gettid() is only unique within a process (the main
thread is always LWP 1), so combine it with the process id, like Solaris.
(cherry picked from commit 53597df11e)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 23:04:40 +03:00
Victor Stinner 5baaa5b86d [3.13] gh-152132: Test Py_CompileString() in test_capi.test_run (#153470) (#153473) (#153533)
[3.14] gh-152132: Test Py_CompileString() in test_capi.test_run (#153470) (#153473)

gh-152132: Test Py_CompileString() in test_capi.test_run (#153470)

PyRun functions now raises ValueError if the start argument is
invalid.

Add Modules/_testlimitedcapi/run.c.

(cherry picked from commit d83d26724b)
(cherry picked from commit 6374772d8c)
2026-07-10 22:25:22 +00:00
Victor Stinner 3d9a42049e [3.13] gh-152132: Fix Py_RunMain() to return an exit code (#153446) (#153455) (#153458)
[3.14] gh-152132: Fix Py_RunMain() to return an exit code (#153446) (#153455)

gh-152132: Fix Py_RunMain() to return an exit code (#153446)

* Fix Py_RunMain() to return an exit code, rather than calling
  Py_Exit(), when running a script, a command, or the REPL.
* _PyRun_SimpleFile() now logs errors to stderr, for example if setting
  __main__.__file__ fails.
* Add tests on Py_RunMain() exitcode.
* Rename functions:

  * _PyRun_SimpleStringFlagsWithName() => _PyRun_SimpleString()
  * _PyRun_SimpleFileObject() => _PyRun_SimpleFile()
  * _PyRun_AnyFileObject() => _PyRun_AnyFile()
  * _PyRun_InteractiveLoopObject() => _PyRun_InteractiveLoop()

* Change _PyRun_SimpleString(), _PyRun_SimpleFile(), _PyRun_AnyFile() and
  _PyRun_InteractiveLoop() return type to PyObject*.
* pymain_repl() now displays the error if PySys_Audit() or
  import _pyrepl failed.
* PyRun_SimpleFileExFlags() and PyRun_AnyFileExFlags() now log
  PyUnicode_DecodeFSDefault() error. So these functions can no longer
  return -1 with an exception set.

(cherry picked from commit fac72f1ee9)
(cherry picked from commit 62c34a62c2)
2026-07-09 22:50:58 +02:00
Victor Stinner 91abe31b2c [3.13] gh-152132: Test all PyRun functions in test_capi.test_run (#153352) (#153414)
gh-152132: Test all PyRun functions in test_capi.test_run (#153352)

PyRun_InteractiveOneObjectEx() now raises TypeError if the second
parameter type is not str.

(cherry picked from commit cd9994e283)
2026-07-09 13:57:21 +00:00
Miss Islington (bot)andsobolevn 39264edce7 [3.13] gh-153252: Fix error handling in _PyCompile_CodeGen (GH-153253) (#153283)
gh-153252: Fix error handling in `_PyCompile_CodeGen` (GH-153253)
(cherry picked from commit a74280e669)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-07-07 17:03:10 +00:00
eca0efea19 [3.13] gh-152682: Fix NULL dereference on OOM in symtable_visit_type_param_bound_or_default (GH-152684) (#152697)
In `symtable_visit_type_param_bound_or_default()`, when a reserved name
(e.g. `__classdict__`) is used as a type parameter, `PyUnicode_FromFormat()`
is called to build the SyntaxError message. If the allocation fails and
returns NULL, the subsequent `PyErr_SetObject()` and `Py_DECREF()` calls
would dereference NULL, causing a segfault.

Fix by returning 0 immediately when `PyUnicode_FromFormat()` returns NULL.
This propagates the MemoryError set by `PyUnicode_FromFormat()`.

The bug was introduced in gh-128632 (commit 891c61c).
(cherry picked from commit 10ed03edf1)

Co-authored-by: Petr Vaganov <petrvaganoff@gmail.com>

* Remove test

---------

Co-authored-by: Petr Vaganov <petrvaganoff@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-07-06 17:36:17 +01:00
7b178f6cc2 [3.13] gh-152849: Fix OverflowError message for out-of-range timestamps in the time module (GH-152850) (#153207)
(cherry picked from commit 2d7a74ece7)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-07-06 15:13:32 +00:00
tonghuaroot (童话) cdc1472dfd [3.13] gh-151763: Fix OOM-0013 crash when the parser or compiler fails to allocate (GH-151968) (#152840) 2026-07-02 09:22:46 +01:00
Stan Ulbrych 16381511eb [3.13] gh-152375: Fix undefined behaviour in the INSTRUMENTED_JUMP macro (GH-152376) (#152577)
(cherry picked from commit cdec9acd63)
2026-06-29 10:04:56 +00:00
Miss Islington (bot)anddev a1f31af280 [3.13] gh-151773: Fix NULL dereference in PyContextVar_Set (GH-151836) (#152011)
gh-151773: Fix NULL dereference in `PyContextVar_Set` (GH-151836)
(cherry picked from commit d35b1719a5)

Co-authored-by: dev <b.chouksey27@gmail.com>
2026-06-23 14:39:29 +00:00
Miss Islington (bot)andStan Ulbrych 807333df72 [3.13] gh-151112: Move an assert that may fail in cfg_builder_check (GH-151153) (#151315)
(cherry picked from commit 2d3381035d)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-11 09:40:49 +00:00
Victor Stinner db9e7556c3 [3.13] gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250) (#151269) (#151283) (#151287)
[3.14][3.15] gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250) (#151269) (#151283)

[3.15] gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250) (#151269)

gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250)

If "import encodings" fails at Python startup, dump the Python path
configuration to help users debugging their configuration. The
encodings module is the first module imported during Python startup.

(cherry picked from commit 7b6e98911e)
(cherry picked from commit 10f616cf39)
(cherry picked from commit b3a7758d8a)
2026-06-10 23:24:46 +02:00
Miss Islington (bot)andStan Ulbrych 310125eb9d [3.13] gh-151112: Fix double free in assemble_init when out of memory (GH-151142) (#151207)
gh-151112: Fix double free in `assemble_init` when out of memory (GH-151142)
(cherry picked from commit 580499177c)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-09 21:13:40 +01:00
Miss Islington (bot)andsobolevn 140af0fd14 [3.13] gh-151126: Fix missing PyErr_NoMemory() in remove_unused_consts (GH-151127) (#151136)
gh-151126: Fix missing `PyErr_NoMemory()` in `remove_unused_consts` (GH-151127)
(cherry picked from commit 3186547c1e)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-09 10:27:34 +00:00
Miss Islington (bot)andThomas Kowalski 4834b45ee7 [3.13] gh-150633: Properly handle null characters in the name when importing frozen modules (GH-150634) (GH-151102)
(cherry picked from commit 54de5475cd)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
2026-06-08 18:55:43 +00:00
7c5734c791 [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814)
gh-150319: Replace all documentation which says "See PEP 585" (#150325)

* Replace all documentation which says "See PEP 585"

The following classes in the stdlib get simple updates:

- array.array
- asyncio.Future
- asyncio.Task
- collections.defaultdict
- collections.deque
- contextvars.ContextVar
- contextvars.Token
- ctypes.Array
- os.DirEntry
- re.Match
- re.Pattern
- string.templatelib.Interpolation
- string.templatelib.Template
- types.MappingProxyType
- queue.SimpleQueue
- weakref.ref

The following classes are documented publicly as functions, and are
therefore updated internally (`__class_getitem__.__doc__`) but not in the
public docs:

- functools.partial
- itertools.chain

The following builtin types have updates to `__class_getitem__.__doc__`
but not to any documentation pages:

- BaseExceptionGroup
- coroutines (from generators)
- dict
- enumerate
- frozendict
- frozenset
- generators (and async generators)
- list
- memoryview
- set
- slice
- tuple

Special cases:

- union objects are now documented as "supporting class-level []",
  rather than anything to do with generics.

- Templates might be generic over a single type (union, in theory) or
  over a TypeVarTuple. As this is not currently fully settled, it is
  marked with a comment and a mild hint that it is a single type is used
  (namely, "type" is singular rather than "types", plural)

* Apply suggestions from code review



* Correct several class getitem docs

And expand the text for tuples.



* Add notes on generic typing of builtins

* Fix typo in tuple.__class_getitem__ docstring

* Typo fix: malformed refs

Fix `generic` links which weren't marked as `:ref:`.

* Strike unnecessary docs on generic-ness



* Apply suggestions from code review

These are applied at both the originally indicated locations and in the
corresponding docstring definitions.



* Update Doc/library/re.rst



* Update Objects/enumobject.c



* Remove tuple generic doc in 'stdtypes' page

This is covered in more detail in the cross-linked typing documentation.
The other copy of this documentation -- in the docstring for
`tuple.__class_getitem__` -- is left in place.

* Fix whitespace around new doc of generics

Per review, do not introduce or remove whitespace such that section
breaks are altered by the introduction of doc on various generic types.

In most cases, this is a removal of an extra line.

In one case (Arrays), it is the reintroduction of a line.

Additionally, two other minor fixes are included:
- incorrect indent on 'defaultdicts'
- make `mappingproxy.__class_getitem__.__doc__` consistent with other
  mapping type generic docs



* Move placement of memoryview generic note

Previous placement was at the end of the main docstring, which is
consistent with other types but places it after a section on various
methods (which makes it read somewhat inconsistently). Moving it up
helps resolve.



* Ensure sphinxdoc does not start sentences lowercase

Lowercase class names at the start of sentences are marked out with the
`class` role. In the case of `deque`, documentation already refers to
these as `Deques`, so this form is preferred.

* Apply suggestions from code review



* Fix line endings and wrap more tightly

Line endings fixed by pre-commit ; also re-wrapped the MappingProxyType
text which was too long.

* Use 'ContextVars' style in sphinx doc

---------

Co-authored-by: Stephen Rosen <sirosen@globus.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <906600+JelleZijlstra@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-06-02 22:26:33 +00:00
Miss Islington (bot)andRussell Keith-Magee 3eab77f28f [3.13] gh-150644: Tag Apple system log messages as public. (GH-150645) (#150740)
macOS 26 changed the default visibility of "dynamic" system messages. This
changes the logging strategy to tag all messages as "public" so they are
visible in the system log without special configuration.
(cherry picked from commit 71fc4c66d3)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-06-01 22:48:28 +00:00
ddd50ab27a [3.13] gh-139808: Add branch protections for aarch64 in asm_trampoline.S (GH-130864) (GH-150189) (#150194)
[3.14] gh-139808: Add branch protections for aarch64 in asm_trampoline.S (GH-130864) (GH-150189)

gh-139808: Add branch protections for aarch64 in asm_trampoline.S (GH-130864)

Apply protection against ROP/JOP attacks for aarch64 on asm_trampoline.S.

The BTI flag must be applied in assembler sources for this class
of attacks to be mitigated on newer aarch64 processors.

See also:
https://sourceware.org/annobin/annobin.html/Test-branch-protection.html
and
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/enabling-pac-and-bti-on-aarch64

The 3.14 backport makes Python/jit_unwind.c changes in
Python/perf_jit_trampoline.c.

(cherry picked from commit da8477b25c)
(cherry picked from commit c863e96455)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: stratakis <cstratak@redhat.com>
2026-05-28 19:10:24 +02:00
Serhiy Storchaka 68840510e3 [3.13] gh-150285: Fix too long docstrings in Argument Clinic code (GH-150338) (GH-150350) (GH-150473) (GH-150526)
(cherry picked from commit 49975a511f)
(cherry picked from commit cf73b17adf)
(cherry picked from commit 287c98f4cb)
2026-05-27 18:06:50 +00:00
Serhiy Storchaka 43b6b483b2 [3.13] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) (GH-150472)
(cherry picked from commit 730fc6a858)
(cherry picked from commit e1e06be119)
2026-05-26 10:34:50 +00:00
Miss Islington (bot) ab4df90364 [3.13] gh-149156: Fix perf trampoline crash after fork (GH-150347) (#150393) 2026-05-25 19:19:07 +01:00
Miss Islington (bot)andpengyu lee 95c93239be [3.13] gh-150178: Fix refcount leaks in hamt allocation failure paths (GH-150179) (#150301)
gh-150178: Fix refcount leaks in hamt allocation failure paths (GH-150179)
(cherry picked from commit 32823af153)

Co-authored-by: pengyu lee <lipengyu@kylinos.cn>
2026-05-23 14:54:11 +05:30
Stan UlbrychandJelle Zijlstra ea8c3e028b [3.13] gh-145376: Fix various reference leaks (GH-145377) (#148661)
(cherry picked from commit bd13cc09fa)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-12 18:35:27 +00:00
Miss Islington (bot)andWulian233 6d6471b7eb [3.13] gh-148418: Fix a possible reference leak in a corrupted TYPE_CODE marshal stream (GH-148419) (GH-149364)
(cherry picked from commit c3972f2795)

Co-authored-by: Wulian233 <1055917385@qq.com>
2026-05-04 14:06:00 +00:00
Irit Katriel 8da3d39c51 [3.13] gh-148973: fix segfault on mismatch between consts size and oparg in compiler (GH-148974) (#148997) 2026-04-25 22:59:40 +01:00
Sam Gross 1b2301c009 [3.13] gh-148820: Fix _PyRawMutex use-after-free on spurious semaphore wakeup (gh-148852) (#148885)
_PyRawMutex_UnlockSlow CAS-removes the waiter from the list and then
calls _PySemaphore_Wakeup, with no handshake. If _PySemaphore_Wait
returns Py_PARK_INTR, the waiter can destroy its stack-allocated
semaphore before the unlocker's Wakeup runs, causing a fatal error from
ReleaseSemaphore / sem_post.

Loop in _PyRawMutex_LockSlow until _PySemaphore_Wait returns Py_PARK_OK,
which is only signalled when a matching Wakeup has been observed.

Also include GetLastError() and the handle in the Windows fatal messages
in _PySemaphore_Init, _PySemaphore_Wait, and _PySemaphore_Wakeup to make
similar races easier to diagnose in the future.

(cherry picked from commit ad3c5b7958)
2026-04-22 18:56:24 +00:00
Serhiy Storchaka ac1c1e7ef0 [3.13] gh-148653: Fix some marshal errors related to recursive code objects (GH-148698) (GH-148711) (GH-148713)
(cherry picked from commit d496c637a3)

Forbid marshalling recursive code objects which
cannot be correctly unmarshalled.
Add multiple tests for recursive data structures.
(cherry picked from commit 2e37d83641)
2026-04-18 09:29:38 +00:00
8a0993f500 [3.13] GH-146128: Remove the buggy AArch64 "33rx" relocation (#146263) (#148199)
GH-146128: Remove the buggy AArch64 "33rx" relocation (#146263)

(cherry picked from commit 6bb7b33e8f)

Co-authored-by: Brandt Bucher <brandt@python.org>
Co-authored-by: Ken Jin <kenjin@python.org>
2026-04-07 20:10:33 +02:00
sunmy2019 c0eae2a1c3 [3.13] gh-146615: Fix format specifiers in Objects/ directory (GH-146620) (#147705)
* Fix format specifiers in vgetargskeywordsfast_impl for improved error messages.
* Fix f-string syntax error message in tok_get_normal_mode.
2026-04-01 21:52:14 +00:00
Serhiy Storchakaandsunmy2019 e726d28a23 [3.13] gh-146615: Fix format specifiers in Python/ directory (GH-146619) (GH-146654)
(cherry picked from commit dcb260eff2)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2026-03-31 09:16:44 +00:00
Miss Islington (bot)andWulian233 fc4b4221e5 [3.13] gh-146244: Fix initconfig.c SET_ITEM macro leaks dict on expression failure (GH-146246) (GH-146433)
(cherry picked from commit 9343518c6f)

Co-authored-by: Wulian233 <1055917385@qq.com>
2026-03-25 19:32:20 +00:00
T. Wouters 684e7af8cd [3.13] gh-142183: Cache one datachunk per tstate to prevent alloc/dealloc thrashing (GH-145789) (#146123)
* gh-142183: Cache one datachunk per tstate to prevent alloc/dealloc thrashing (GH-145789) (#145828)

Cache one datachunk per tstate to prevent alloc/dealloc thrashing when repeatedly hitting the same call depth at exactly the wrong boundary.

Move new _ts member to the end to not mess up remote debuggers' ideas of the
struct's layout. (The struct is only created by the runtime, and the new
field only used by the runtime, so it should be safe.)

(cherry picked from commit 706fd4ec08)
(cherry picked from commit 19cbcc0f85)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
2026-03-24 02:27:57 +01:00
Sergey MiryanovandNeil Schemenauer eda53e6cf1 [3.13] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (GH-144214)
Weakrefs to unreachable garbage that are created during running of
finalizers need to be cleared.  This avoids exposing objects that
have `tp_clear` called on them to Python-level code.
(cherry picked from commit b6b99bf7f1)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2026-03-24 00:50:41 +01:00
Miss Islington (bot)andVictor Stinner 53b544a6a7 [3.13] gh-146092: Handle _PyFrame_GetFrameObject() failures properly (GH-146124) (GH-146132) (#146138)
[3.14] gh-146092: Handle _PyFrame_GetFrameObject() failures properly (GH-146124) (GH-146132)

gh-146092: Handle _PyFrame_GetFrameObject() failures properly (GH-146124)

* Fix _PyFrame_GetLocals() and _PyFrame_GetLocals() error handling.
* _PyEval_ExceptionGroupMatch() now fails on _PyFrame_GetLocals()
  error.
(cherry picked from commit 8eeb800faf)


(cherry picked from commit e1e4852133)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-18 21:23:26 +01:00