Commit Graph

14318 Commits

Author SHA1 Message Date
Miss Islington (bot) 07a6aa3f8f
[3.13] gh-125631: Enable setting persistent_id and persistent_load of pickler and unpickler (GH-125752) (GH-126528)
pickle.Pickler.persistent_id and pickle.Unpickler.persistent_load can
again be overridden as instance attributes.
(cherry picked from commit 223d3dc554)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-07 07:21:23 +00:00
Miss Islington (bot) 83827ad819
[3.13] gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485) (#126495)
gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485)

Handle _Unpickler_SetStringInput() failure.
(cherry picked from commit a1c57bcfd2)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-06 13:51:39 +00:00
Bénédikt Tran 6e9da38866
[3.13] gh-126313: Fix a crash in curses.napms() due to incorrect error handling (GH-126351) (#126493)
gh-126313: Fix a crash in curses.napms() due to incorrect error handling (GH-126351)
2024-11-06 14:33:23 +01:00
Miss Islington (bot) 6a084b9d60
[3.13] gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481) (#126486)
gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481)

Prevent creation of incomplete/invalid _ssl.SSLSocket objects when
created directly.
(cherry picked from commit b1c4ffc205)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-06 11:24:45 +00:00
Miss Islington (bot) ffb44cd08c
[3.13] gh-126425: Refactor `_lsprof_Profiler_enable` (GH-126426) (#126442)
gh-126425: Refactor `_lsprof_Profiler_enable` (GH-126426)

- Explicit memory management for `None` objects (since we still try to treat immortal objects as regular objects)
- Respect possible errors of `sys.monitoring.register_callback` call
(cherry picked from commit 75872605aa)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-05 12:48:18 +00:00
Miss Islington (bot) ce1a1a6021
[3.13] gh-126303: Fix pickling and copying of os.sched_param objects (GH-126336) (GH-126423)
(cherry picked from commit d3840503b0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-05 06:50:33 +00:00
Miss Islington (bot) f58d5ab881
[3.13] gh-126138: Fix use-after-free in `_asyncio.Task` by evil `__getattribute__` (GH-126305) (#126324)
gh-126138: Fix use-after-free in `_asyncio.Task` by evil `__getattribute__` (GH-126305)
(cherry picked from commit f032f6ba8f)

Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-11-02 08:09:18 +00:00
Miss Islington (bot) 1b9710c571
[3.13] gh-126220: Fix crash on calls to `_lsprof.Profiler` methods with 0 args (backportable) (GH-126271) (#126310)
gh-126220: Fix crash on calls to `_lsprof.Profiler` methods with 0 args (backportable) (GH-126271)
(cherry picked from commit 28b148fb32)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-11-01 22:24:06 +00:00
Miss Islington (bot) abe64a3780
[3.13] gh-126080: fix UAF on `task->task_context` in `task_call_step_soon` due to an evil `loop.__getattribute__` (GH-126120) (#126250)
gh-126080: fix UAF on `task->task_context` in `task_call_step_soon` due to an evil `loop.__getattribute__` (GH-126120)
(cherry picked from commit 0e8665554b)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-31 19:32:47 +00:00
Miss Islington (bot) 89664d4d48
[3.13] gh-126223: Propagate unicode errors in `_interpreters.create()` (GH-126224) (#126242)
gh-126223: Propagate unicode errors in `_interpreters.create()` (GH-126224)
(cherry picked from commit 01415213d7)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-31 14:46:36 +00:00
Miss Islington (bot) ac00bf0e96
[3.13] gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (GH-126103) (#126229)
gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (GH-126103)
(cherry picked from commit d07dcce693)

Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
2024-10-31 08:14:00 +00:00
Miss Islington (bot) e2c188455f
[3.13] gh-126106: Fix `NULL` possible derefrence in `Modules/_ssl.c` (GH-126111) (#126116)
gh-126106: Fix `NULL` possible derefrence in `Modules/_ssl.c` (GH-126111)
(cherry picked from commit a64a1c9206)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-29 09:29:10 +00:00
Miss Islington (bot) e7c63107d1
[3.13] Align functools.reduce() docstring with PEP-257 (GH-126045) (#126113)
Yak-shave in preparation for Argument Clinic adaption in gh-125999.

(cherry picked from commit 9b14083497)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-10-29 10:13:35 +01:00
Miss Islington (bot) 97c2e6ac27
[3.13] gh-126035: add missing whitespace to *Py_EnterRecursiveCall() messages (GH-126036) (#126058)
(cherry picked from commit 19e93e2e26)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-27 22:19:37 +00:00
Miss Islington (bot) ac31a2607f
[3.13] gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (GH-125967) (#126047)
gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (GH-125967)
(cherry picked from commit ed5059eeb1)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-27 17:36:10 +00:00
Miss Islington (bot) 25421c715d
[3.13] gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (GH-126003) (#126043)
gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (GH-126003)
(cherry picked from commit f819d4301d)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-27 15:28:02 +00:00
Miss Islington (bot) 9c6cda5ccb
[3.13] gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` (GH-125970) (#125991)
gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` (GH-125970)
(cherry picked from commit c5b99f5c2c)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-10-25 18:43:07 +00:00
Kumar Aditya f54e1a2d64
[3.13] GH-125789: fix `fut._callbacks` to always return a copy of callbacks (#125922) (#125976)
GH-125789: fix `fut._callbacks` to always return a copy of callbacks (#125922)

Fix `asyncio.Future._callbacks` to always return a copy of the internal list of callbacks to avoid mutation from user code affecting the internal state.

(cherry picked from commit cae853e3b4)
2024-10-25 13:19:31 +00:00
Miss Islington (bot) 77d79989fd
[3.13] gh-123978: Remove broken time.thread_time() on NetBSD (GH-124116) (GH-124425)
(cherry picked from commit e670a113b5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-23 19:39:34 +03:00
Miss Islington (bot) 0e350d4bf6
[3.13] gh-125716: Use a Global Mutex When Initializing Global State For the _interpqueues Module (gh-125817)
This includes a drive-by cleanup in _queues_init() and _queues_fini().

This change also applies to the _interpchannels module.

(cherry picked from commit 4848b0b92c, AKA gh-125803)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-10-21 22:16:32 +00:00
Miss Islington (bot) b752764f9e
[3.13] gh-125716: Raise an Exception If _globals_init() Fails In the _interpqueues Module (gh-125808)
The fix applies to the _interpchannels module as well.

I've also included a drive-by typo fix for _interpqueues.

(cherry picked from commit 44f841f01a, AKA gh-125802)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-10-21 20:05:06 +00:00
Miss Islington (bot) c1c3f5d19e
[3.13] gh-124969: Make locale.nl_langinfo(locale.ALT_DIGITS) returning a string again (GH-125774) (GH-125804)
This is a follow up of GH-124974. Only Glibc needed a fix.
Now the returned value is a string consisting of semicolon-separated
symbols on all Posix platforms.
(cherry picked from commit dcc4fb2c90)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-21 19:30:23 +00:00
Miss Islington (bot) e57831f301
[3.13] gh-125667: Statically Initialize the Arg Converter Data Values in _interpqueuesmodule.c (gh-125670)
gh-125667: Statically Initialize the Arg Converter Data Values in _interpqueuesmodule.c (gh-125668)
(cherry picked from commit 7cf2dbc3cb)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-10-18 00:13:54 +00:00
Serhiy Storchaka 08ccbb9b3f
[3.13] gh-52551: Fix encoding issues in strftime() (GH-125193) (GH-125657)
Fix time.strftime(), the strftime() method and formatting of the
datetime classes datetime, date and time.

* Characters not encodable in the current locale are now acceptable in
  the format string.
* Surrogate pairs and sequence of surrogatescape-encoded bytes are no
  longer recombinated.
* Embedded null character no longer terminates the format string.

This fixes also gh-78662 and gh-124531.

(cherry picked from commit ad3eac1963)
2024-10-17 22:48:34 +03:00
Miss Islington (bot) 6474e296c0
[3.13] gh-125243: Fix ZoneInfo data race in free threading build (GH-125281) (gh-125414)
Lock `ZoneInfoType` to protect accesses to `ZONEINFO_STRONG_CACHE`.
Refactor the `tp_new` handler to use Argument Clinic so that we can just
use `@critical_section` annotations on the relevant functions.

Also use `PyDict_SetDefaultRef` instead of `PyDict_SetDefault` when
inserting into the `TIMEDELTA_CACHE`.
(cherry picked from commit f1d33dbddd)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-10-15 17:02:32 -04:00
Jelle Zijlstra e646cc369e
[3.13] gh-124917: Allow keyword args to os.path.exists/lexists on Windows (GH-124918) (#125332)
(cherry picked from commit cc2938a189)
2024-10-11 15:18:33 -07:00
Miss Islington (bot) f589513334
[3.13] gh-116738: Make `_csv` module thread-safe (GH-118344) (#125328)
gh-116738: Make `_csv` module thread-safe (GH-118344)
(cherry picked from commit a00221e5a7)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-10-11 18:22:56 +00:00
Miss Islington (bot) 66b8cb1142
[3.13] gh-125235: Keep `_tkinter` TCL paths pointing to base installation on Windows (GH-125250) (#125312)
gh-125235: Keep `_tkinter` TCL paths pointing to base installation on Windows (GH-125250)
(cherry picked from commit b3aa1b5fe2)

Signed-off-by: y5c4l3 <y5c4l3@proton.me>
Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com>
2024-10-11 09:34:04 +00:00
Serhiy Storchaka 26a93189e4
[3.13] gh-124969: Fix locale.nl_langinfo(locale.ALT_DIGITS) (GH-124974) (#125232)
Returns a tuple of up to 100 strings for ALT_DIGITS lookup (an empty tuple on most locales).
Previously it returned the first item of that tuple or an empty string.
(cherry picked from commit 21c04e1a97)
2024-10-11 05:56:22 +08:00
Sergey B Kirpichev c2cb1a89b7
[3.13] gh-125118: don't copy arbitrary values to _Bool in the struct module (GH-125169) (#125263)
memcopy'ing arbitrary values to _Bool variable triggers undefined
behaviour. Avoid this.
We assume that `false` is represented by all zero bytes.

Credits to Alex Gaynor.

(cherry picked from commit 87d7315ac5)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-10 14:58:57 +00:00
Raymond Hettinger 7bc99dd49e
[3.13] Tee of tee was not producing n independent iterators (gh-123884) (gh-125081) 2024-10-08 14:11:43 -05:00
Kumar Aditya 20242a437c
[3.13] gh-117721: use PyMutex in `_thread.lock` (#125110) (#125116)
* gh-117721: use PyMutex in `_thread.lock` (#125110)

(cherry picked from commit fca552993d)
2024-10-08 21:16:48 +05:30
Jelle Zijlstra 761c3b280b
[3.13] gh-102511: Change the `os.path.splitroot` param name from `path` back to `p` (GH-124097) (#124919)
(cherry picked from commit 3b6bfa77aa)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-10-07 18:42:49 -07:00
Miss Islington (bot) 2d3087b3cf
[3.13] gh-120378: Fix crash caused by integer overflow in `curses` (GH-124555) (#124905)
gh-120378: Fix crash caused by integer overflow in `curses` (GH-124555)

This is actually an upstream problem in curses, and has been reported
to them already:
https://lists.gnu.org/archive/html/bug-ncurses/2024-09/msg00101.html

This is a nice workaround in the meantime to prevent the segfault.

(cherry picked from commit c2ba931318)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-07 23:46:57 +02:00
Miss Islington (bot) f5f1d45f17
[3.13] gh-116810: fix memory leak in ssl module (GH-123249) (#124800)
gh-116810: fix memory leak in ssl module (GH-123249)

Resolve a memory leak introduced in CPython 3.10's :mod:`ssl` when the :attr:`ssl.SSLSocket.session` property was accessed. Speeds up read and write access to said property by no longer unnecessarily cloning session objects via serialization.

(cherry picked from commit 7e7223e18f)

Co-authored-by: Jeffrey R. Van Voorst <jeff.vanvoorst@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Antoine Pitrou <antoine@python.org>
2024-10-07 23:46:29 +02:00
Victor Stinner d432fa43b9
[3.13] Fix typos (#123775) (#123866)
Fix typos (#123775)

(cherry picked from commit 9017b95ff2)

Co-authored-by: algonell <algonell@gmail.com>
2024-10-07 23:44:31 +02:00
T. Wouters e0eb44ad49
[3.13] GH-124567: Revert the Incremental GC in 3.13 (#124770)
Revert the incremental GC in 3.13, since it's not clear that without further turning, the benefits outweigh the costs.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-09-30 21:27:29 +00:00
Sergey B Kirpichev 99185bd649
[3.13] gh-123836: workaround fmod(x, y) bug on Windows (GH-124171) (#124187)
Buildbot failure on Windows 10 with MSC v.1916 64 bit (AMD64):
FAIL: testFmod (test.test_math.MathTests.testFmod)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 605, in testFmod
    self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 258, in ftest
    self.fail("{}: {}".format(name, failure))
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: fmod(-10, 1): expected -0.0, got 0.0 (zero has wrong sign)

Here Windows loose sign of the result; if y is nonzero, the result
should have the same sign as x.

This amends commit 28aea5d07d.
(cherry picked from commit f4dd440210)
2024-09-29 18:14:02 -07:00
Miss Islington (bot) dbfc37a5f8
[3.13] gh-123797: Check for runtime availability of `ptsname_r` on macos (GH-123806) (#124270)
gh-123797: Check for runtime availability of `ptsname_r` on macos (GH-123806)
(cherry picked from commit 3e36e5aef1)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-09-29 18:06:53 -07:00
Miss Islington (bot) dddae6647e
[3.13] gh-124248: Fix crash in struct when processing 0p fields (GH-124251) (#124277)
gh-124248: Fix crash in struct when processing 0p fields (GH-124251)
(cherry picked from commit 63f196090f)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2024-09-29 18:06:32 -07:00
Miss Islington (bot) 8169d2971f
[3.13] gh-123017: Add Android to the list of platforms where `strftime` doesn't support negative years (GH-124467) (#124674)
gh-123017: Add Android to the list of platforms where `strftime` doesn't support negative years (GH-124467)

Add Android to the list of platforms where `strftime` doesn't support negative years
(cherry picked from commit 0a3577bdfc)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2024-09-27 11:00:49 -07:00
Malcolm Smith 9f5b921491
[3.13] gh-123014: Disable pidfd API on older Android versions (GH-124458) (#124543)
gh-123014: Disable pidfd API on older Android versions (#124458)

(cherry picked from commit c58c572a65)
2024-09-26 13:36:12 -07:00
Miss Islington (bot) 9d21c46e31
[3.13] gh-121023: Improve `_xxtestfuzz/README.rst` (GH-121024) (#124140)
gh-121023: Improve `_xxtestfuzz/README.rst` (GH-121024)
(cherry picked from commit a9c2bc1634)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2024-09-23 17:23:54 -07:00
Miss Islington (bot) de8dc92db7
[3.13] gh-123880: Allow recursive import of single-phase-init modules (GH-123950) (#124273)
gh-123880: Allow recursive import of single-phase-init modules (GH-123950)

(cherry picked from commit aee219f455)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2024-09-23 12:56:00 -07:00
Miss Islington (bot) e443187fce
[3.13] gh-123657: Fix crash and refleak in `decimal.getcontext()` (GH-123703) (GH-123774)
(cherry picked from commit 853588e24c)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2024-09-06 15:18:01 +02:00
Miss Islington (bot) 9810dfa352
[3.13] gh-123678: Upgrade libexpat 2.6.3 (GH-123689) (GH-123707)
gh-123678: Upgrade libexpat 2.6.3 (GH-123689)

(cherry picked from commit 40bdb0deee)

Co-authored-by: Seth Michael Larson <seth@python.org>
2024-09-05 13:37:40 +02:00
Petr Viktorin d655c65561
[3.13] gh-123091: Use more _Py_IsImmortalLoose() (GH-123602) (GH-123622)
Switch more _Py_IsImmortal(...) assertions to _Py_IsImmortalLoose(...)

The remaining calls to _Py_IsImmortal are in free-threaded-only code,
initialization of core objects, tests, and guards that fall back to
code that works with mortal objects.

(cherry picked from commit 57c471a688)
2024-09-03 12:36:42 +02:00
Miss Islington (bot) ab29053784
[3.13] gh-123431: Harmonize extension code checks in pickle (GH-123434) (#123459)
gh-123431: Harmonize extension code checks in pickle (GH-123434)

This checks are redundant in normal circumstances and can only work if
the extension registry was intentionally broken.

* The Python implementation now raises exception for the extension code
  with false boolean value.
* Simplify the C code. RuntimeError is now raised in explicit checks.
* Add many tests.
(cherry picked from commit 0c3ea30238)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-02 13:17:16 +02:00
Miss Islington (bot) cbcb9e1c0f
[3.13] gh-111495: Add tests for PyNumber C API (GH-111996) (#123375)
gh-111495: Add tests for PyNumber C API (GH-111996)
(cherry picked from commit 2f20f5a9bc)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-09-02 13:11:06 +02:00
Miss Islington (bot) d9e4c4b61c
[3.13] gh-123213: Fixed xml.etree.ElementTree.Element.extend and assignment to no longer hide exceptions (GH-123214) (#123257)
gh-123213: Fixed xml.etree.ElementTree.Element.extend and assignment to no longer hide exceptions (GH-123214)
(cherry picked from commit 90b6d0e0f8)

Co-authored-by: Bar Harel <bharel@barharel.com>
2024-09-02 13:10:09 +02:00