gh-121621: Move asyncio_running_loop to private struct (GH-121939)
This avoids changing the ABI and keeps the field in the private struct.
(cherry picked from commit 81fd625b5c)
Co-authored-by: Sam Gross <colesbury@gmail.com>
gh-121528: Fix _PyObject_Init() assertion for stable ABI (GH-121725)
Add _Py_IsImmortalLoose() function for assertions.
(cherry picked from commit b826e459ca)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-78889: Stop IDLE Shell freezes from sys.stdout.shell.xyz (GH-121876)
Problem occurred when attribute xyz could not be pickled.
Since this is not trivial to selectively fix, block all
attributes (other than 'width'). IDLE does not access them
and they are private implementation details.
(cherry picked from commit 58753f33e4)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs
* Document immortality in some functions that take `const char *`
This is PyUnicode_InternFromString;
PyDict_SetItemString, PyObject_SetAttrString;
PyObject_DelAttrString; PyUnicode_InternFromString;
and the PyModule_Add convenience functions.
Always point out a non-immortalizing alternative.
* Don't immortalize user-provided attr names in _ctypes
(cherry picked from commit b4aedb23ae)
* The result has type Py_ssize_t, not intptr_t.
* Type cast between unsigned and signed integer types should be explicit.
* Downcasting should be explicit.
* Fix integer overflow check in sum().
(cherry picked from commit 1801545)
The object's inline values may be marked invalid if the materialized
dict was already initialized and then deleted.
(cherry picked from commit 162b41f577)
Co-authored-by: Sam Gross <colesbury@gmail.com>
gh-121403: Add notes for PyList_GetXXX APIs about the need for init (gh-121626)
(cherry picked from commit 2bac2b86b1)
Co-authored-by: Donghee Na <donghee.na@python.org>
gh-113993: For string interning, do not rely on (or assert) _Py_IsImmortal (GH-121358)
Older stable ABI extensions are allowed to make immortal objects mortal.
Instead, use `_PyUnicode_STATE` (`interned` and `statically_allocated`).
(cherry picked from commit 956270d08d)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
This reverts commit 0dfb437a32 prior
to the release of 3.13.0b4 to allow for additional review time.
(cherry picked from commit f27593a87c)
Co-authored-by: Ned Deily <nad@python.org>
gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH-121792)
(cherry picked from commit 8b6d475581)
Co-authored-by: sobolevn <mail@sobolevn.me>
When using the ** operator or pow() with Fraction as the base
and an exponent that is not rational, a float, or a complex, the
fraction is no longer converted to a float.
(cherry picked from commit b9965ef282)
Co-authored-by: Joshua Herman <30265+zitterbewegung@users.noreply.github.com>
console.compile with the "single" param throws an exception when
there are multiple statements, never allowing to adding newlines
to a pasted code block (gh-121610)
This adds a few extra checks to allow extending when in an indented
block, and tests for a few examples.
(cherry picked from commit 7d111dac16)
Co-authored-by: saucoide <32314353+saucoide@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
gh-120831: Increase the default minimum supported iOS version to 13.0 (GH-121250)
Increases the default minimum iOS version to 13.0.
(cherry picked from commit 7e91e0dcfe)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
The fallback repl does not support "exit" without parentheses, so the
test would hang until the timeout expired.
(cherry picked from commit 4134261ab8)
Co-authored-by: Sam Gross <colesbury@gmail.com>
We should maintain the invariant that a zero `ob_tid` implies the
refcount fields are merged.
* Move the assignment in `_Py_MergeZeroLocalRefcount` to immediately
before the refcount merge.
* Update `_PyTrash_thread_destroy_chain` to set `ob_ref_shared` to
`_Py_REF_MERGED` when setting `ob_tid` to zero.
Also check this invariant with assertions in the GC in debug builds.
That uncovered a bug when running out of memory during GC.
(cherry picked from commit d23be3947c)
Co-authored-by: Sam Gross <colesbury@gmail.com>
This avoids messages like:
ThreadSanitizer: starting new threads after multi-threaded fork is not
supported. Dying (set die_after_fork=0 to override)
(cherry picked from commit 82a4dac9f6)
Co-authored-by: Sam Gross <colesbury@gmail.com>
gh-121546: Disable contextvar caching on free-threading build (GH-121740)
(cherry picked from commit e904300882)
Co-authored-by: Ken Jin <kenjin@python.org>
See 6b98b274b6 for an explanation of the problem and solution. Here I've applied the solution to channels.
(cherry picked from commit 8b209fd4f8, AKA gh-121805)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>