Commit graph

120135 commits

Author SHA1 Message Date
Miss Islington (bot)
b22d0fcbe1
[3.12] gh-128317: Document calendar.TextCalendar.formatweek (GH-128353) (#128358)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-12-30 19:40:31 +02:00
Miss Islington (bot)
be7314ffac
[3.12] gh-127586: multiprocessing.Pool does not properly restore blocked signals (try 2) (GH-128011) (#128299)
gh-127586: multiprocessing.Pool does not properly restore blocked signals (try 2) (GH-128011)

Correct pthread_sigmask in resource_tracker to restore old signals

Using SIG_UNBLOCK to remove blocked "ignored signals" may accidentally
cause side effects if the calling parent already had said signals
blocked to begin with and did not intend to unblock them when
creating a pool. Use SIG_SETMASK instead with the previous mask of
blocked signals to restore the original blocked set.
(cherry picked from commit aeb9b65aa2)

Co-authored-by: Stephen Hansen <stephen.paul.hansen@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-12-29 11:02:59 -08:00
Miss Islington (bot)
3a726be127
[3.12] Mention loop_factory argument in docstring for asyncio.run() (GH-128288) (#128292)
Mention loop_factory argument in docstring for asyncio.run() (GH-128288)
(cherry picked from commit 0b5f1fae57)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-12-27 14:15:40 +00:00
Shantanu
82dbfbfec9
[3.12] gh-127537: Add __class_getitem__ to the python implementation of functools.partial (#127537) (#128282)
gh-127537: Add __class_getitem__ to the python implementation of functools.partial (#127537)

(cherry picked from commit 401bba6b58)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
2024-12-27 01:25:07 +00:00
Serhiy Storchaka
f699151c87
[3.12] gh-128198: Add missing error checks for usages of PyIter_Next() (GH-128199) (GH-128273)
(cherry picked from commit 5c814c83cd)

Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
2024-12-26 10:38:48 +00:00
Miss Islington (bot)
11b8909412
[3.12] gh-128227: Regenerate Doc/requirements-oldest-sphinx.txt (GH-128228) (#128230)
gh-128227: Regenerate `Doc/requirements-oldest-sphinx.txt` (GH-128228)
(cherry picked from commit 7985d460c7)

Co-authored-by: Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-24 22:51:06 +02:00
Miss Islington (bot)
d263bc742a
[3.12] gh-126664: revert: Use else instead of finally in docs explaining "with" (GH-128169) (#128171)
gh-126664: revert: Use `else` instead of `finally` in docs explaining "with" (GH-128169)

Revert "gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665)"

This reverts commit 25257d61cf.
(cherry picked from commit 228f275737)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-12-24 10:56:03 -08:00
Miss Islington (bot)
fe41537c60
[3.12] gh-127847: Fix position in the special-cased zipfile seek (GH-127856) (#128226)
gh-127847: Fix position in the special-cased zipfile seek (GH-127856)

---------
(cherry picked from commit 7ed6c5c696)

Co-authored-by: Dima Ryazanov <dima@bucket.xxx>
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: Jason R. Coombs <jaraco@jaraco.com>
2024-12-24 16:15:45 +00:00
Miss Islington (bot)
e7f8ba7444
gh-128217: Validate the normalized_environment variable instead of the similarly named function (GH-128220)
(cherry picked from commit 3ddd70ceaa)

Co-authored-by: Sergey Muraviov <smurav@mail.ru>
2024-12-24 13:25:16 +00:00
Miss Islington (bot)
f65ac86ca1
[3.12] gh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup split function (GH-128079) (#128140)
gh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup split function (GH-128079)
(cherry picked from commit 3879ca0100)

Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
2024-12-20 20:19:12 +00:00
Miss Islington (bot)
23e8fc2775
[3.12] gh-128116: Skip test_socket VSOCK testStream() on PermissionError (GH-128120) (#128124)
gh-128116: Skip test_socket VSOCK testStream() on PermissionError (GH-128120)
(cherry picked from commit cbfe3023e4)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-20 13:39:26 +00:00
Miss Islington (bot)
825b83da96
[3.12] gh-128069: brew link --overwrite tcl-tk@8 to prevent conflict with GitHub image's version (GH-128090) (#128125)
gh-128069: brew link --overwrite tcl-tk@8 to prevent conflict with GitHub image's version (GH-128090)

brew link --overwrite tcl-tk@8 to prevent conflict with GitHub image's version
(cherry picked from commit 46dc1ba9c6)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-12-20 13:07:04 +00:00
Miss Islington (bot)
6def6930a5
[3.12] gh-126742: add NEWS entry for fix of localized error messages (GH-128025) (GH-128060)
(cherry picked from commit 2610bccfdf)
2024-12-19 14:52:42 +01:00
Miss Islington (bot)
34ea7bf56f
[3.12] gh-122706: fix docs for asyncio ssl sockets (GH-128092) (#128093)
gh-122706: fix docs for asyncio ssl sockets (GH-128092)
(cherry picked from commit 19c5134d57)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-19 18:25:54 +05:30
Miss Islington (bot)
6ffa564446
[3.12] gh-126742: Avoid checking for library filename in test_ctypes (GH-128034) (#128057)
gh-126742: Avoid checking for library filename in test_ctypes (GH-128034)

Avoid checking for library filename in `dlerror()` error messages of test_ctypes.
(cherry picked from commit 335e24fb0a)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-18 08:45:34 +00:00
Bénédikt Tran
e0b61ffa38
[3.12] gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746) (GH-128027)
- Add a helper to set an error from locale-encoded `char*`
- Use the helper for gdbm & dlerror messages

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-17 14:53:16 +02:00
Bénédikt Tran
6ac578cf53
[3.12] gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555) (GH-127764)
For dlsym(), a return value of NULL does not necessarily indicate
an error [1].

Therefore, to avoid using stale (or NULL) dlerror() values, we must:

 1. clear the previous error state by calling dlerror()
 2. call dlsym()
 3. call dlerror()

If the return value of dlerror() is not NULL, an error occured.

In ctypes we choose to treat a NULL return value from dlsym()
as a "not found" error. This is the same as the fallback
message we use on Windows, Cygwin or when getting/formatting
the error reason fails.

[1]: https://man7.org/linux/man-pages/man3/dlsym.3.html

Signed-off-by: Georgios Alexopoulos <grgalex42@gmail.com>
Signed-off-by: Georgios Alexopoulos <grgalex@ba.uoa.gr>
Co-authored-by: George Alexopoulos <giorgosalexo0@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-12-17 13:53:43 +02:00
Miss Islington (bot)
073b52bc53
[3.12] Fix typo in itertools docs (gh-127995) (gh-127997) 2024-12-16 11:18:15 -06:00
Victor Stinner
b1cc62ae0f
[3.12] gh-127906: Skip limited C API test_cext tests if Py_TRACE_REFS (#127993)
gh-127906: Skip limited C API test_cext tests if Py_TRACE_REFS

Skip limited C API tests in test_cext and test_cppext if Python is
configured with --with-trace-refs (if the Py_TRACE_REFS macro is
defined).
2024-12-16 18:15:17 +01:00
Miss Islington (bot)
7f707fa6c6
[3.12] gh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361) (GH-127905)
gh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361)

From the ERR_raise manpage:

    ERR_LIB_SYS

        This "library code" indicates that a system error is
        being reported.  In this case, the reason code given
        to `ERR_raise()` and `ERR_raise_data()` *must* be
        `errno(3)`.

This PR only handles ERR_LIB_SYS for the high-lever error types
SSL_ERROR_SYSCALL and SSL_ERROR_SSL, i.e., not the ones where
OpenSSL indicates it has some more information about the issue.
(cherry picked from commit f4b31edf2d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-12-16 15:43:57 +01:00
Miss Islington (bot)
3d7b5b369a
[3.12] gh-127852: add remark about ',' separator (GH-127854) (#127942)
Specify that it is valid for floats and ints with 'd' presentation and an error otherwise.
---------

(cherry picked from commit e2325c9db0)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-12-14 13:37:00 +00:00
Petr Viktorin
d0368556b5
[3.12] gh-126937: ctypes: add test for maximum size of a struct field (GH-126938) (GH-127825) (GH-127909)
This backports the *test* from GH-126938, with changed limit and exception class.

Co-authored-by: Melissa0x1f992 <70096546+Melissa0x1f992@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>

(cherry-picked from d51c1444e3)
2024-12-13 16:51:55 +01:00
Miss Islington (bot)
58916eb211
[3.12] gh-127906: Test the limited C API in test_cppext (GH-127916) (#127920)
gh-127906: Test the limited C API in test_cppext (GH-127916)
(cherry picked from commit d05a4e6a0d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-13 14:14:20 +00:00
Victor Stinner
5a658d85d5
[3.12] gh-127906: Backport test_cext from the main branch (#127912) 2024-12-13 14:48:32 +01:00
Victor Stinner
21c056ec27
[3.12] gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (#127872) (#127918)
gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (#127872)

(cherry picked from commit 6ff38fc4e2)
2024-12-13 13:21:30 +00:00
Victor Stinner
6544f99463
[3.12] gh-127906: Backport test_cppext changes from the main branch (#127915) 2024-12-13 13:51:06 +01:00
Victor Stinner
c77bfd768f
[3.12] gh-127906: Declare timeval struct in pytime.h on Windows (#127908)
gh-127906: Declare timeval struct in pytime.h on Windows

Fix the following MSVC compiler warning:

    include\cpython\pytime.h(192): warning C4115: 'timeval':
    named type definition in parentheses
2024-12-13 12:13:49 +00:00
Miss Islington (bot)
f3a689fd9d
[3.12] gh-107249: Implement Py_UNUSED() for MSVC (GH-107250) (#127907)
gh-107249: Implement Py_UNUSED() for MSVC (GH-107250)

Fix warnings C4100 in Py_UNUSED() when Python is built with "cl /W4".

Example with this function included by Python.h:

    static inline unsigned int
    PyUnicode_IS_READY(PyObject* Py_UNUSED(op))
    { return 1; }

Without this change, building a C program with "cl /W4" which just
includes Python.h emits the warning:

    Include\cpython/unicodeobject.h(199):
    warning C4100: '_unused_op': unreferenced formal parameter

This change fix this warning.
(cherry picked from commit 6a43cce32b)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-13 11:58:47 +00:00
Dmitry Shachnev
b184f4859a
[3.12] gh-127902: Make sure extern "C" is closed when using Py_LIMITED_API (#127904)
Fixes #127902.
2024-12-13 11:18:28 +00:00
Miss Islington (bot)
2d317332c0
[3.12] Document PyObject_SelfIter (GH-127861) (#127899)
Document PyObject_SelfIter (GH-127861)
(cherry picked from commit 58942a07df)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2024-12-13 15:08:19 +05:30
Miss Islington (bot)
793059eb4c
[3.12] link to the correct output method in documentation (GH-127857) (#127901)
link to the correct output method in documentation (GH-127857)
(cherry picked from commit 11ff3286b7)

Co-authored-by: Viktor Kálmán <kviktor@users.noreply.github.com>
2024-12-13 15:07:59 +05:30
Miss Islington (bot)
9081ea4135
[3.12] Fix typo in traceback docs (GH-127884) (#127891)
Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
2024-12-12 21:54:23 +00:00
Miss Islington (bot)
2916f838e6
[3.12] Fix typos in Lib/_pydecimal.py (GH-127700) (#127888)
Fix typos in `Lib/_pydecimal.py` (GH-127700)
(cherry picked from commit ed037d229f)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2024-12-12 20:45:20 +00:00
Miss Islington (bot)
320a1dcd97
[3.12] gh-127563: use dk_log2_index_bytes=3 in empty dicts (GH-127568) (GH-127813)
This fixes a UBSan failure (unaligned zero-size memcpy) in `dictobject.c`.
(cherry picked from commit 9af96f4406)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-12 12:50:51 +01:00
Miss Islington (bot)
b0615a8a9a
[3.12] gh-123401: Fix http.cookies module to support obsolete RFC 850 date format (GH-123405) (#127829)
gh-123401: Fix http.cookies module to support obsolete RFC 850 date format (GH-123405)
(cherry picked from commit 359389ed51)

Co-authored-by: Nano <nanoapezlk@gmail.com>
Co-authored-by: Wulian <1055917385@qq.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-11 15:34:22 +00:00
Victor Stinner
65bca19db5
[3.12] Add extern "C" around PyTraceMalloc_ functions. (#127772) (#127817)
Add `extern "C"` around `PyTraceMalloc_` functions. (#127772)

Pretty much everything else exported by Python.h has an extern "C"
annotation, yet this header appears to be missing one.

(cherry picked from commit 2cdeb61b57)

Co-authored-by: Peter Hawkins <hawkinsp@cs.stanford.edu>
2024-12-11 14:08:23 +01:00
Miss Islington (bot)
0964f9f184
[3.12] GH-117195: Avoid assertion error in object.__sizeof__ (GH-117220) (#127605)
GH-117195: Avoid assertion error in `object.__sizeof__` (GH-117220)
(cherry picked from commit 406ffb5293)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2024-12-11 12:21:07 +01:00
Nice Zombies
487a51a1b9
[3.12] gh-111609: end_offset is ignored in subclasses of SyntaxError (#127554)
* `end_offset` is ignored in subclasses of SyntaxError

* 📜🤖 Added by blurb_it.

* Add test

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-12-11 09:09:34 +00:00
Hugo van Kemenade
20c0c8cf38
[3.12] Update the documentation howto index page and group docs into 3 logical sections (GH-119366) (#127811)
(cherry picked from commit a26d27e7ee)

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2024-12-11 08:58:37 +02:00
Miss Islington (bot)
019e858529
[3.12] Docs: Fix indents in xmlrpc.client.rst (GH-127782) (#127800)
Docs: Fix indents in `xmlrpc.client.rst` (GH-127782)
(cherry picked from commit 035f512046)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2024-12-10 17:44:45 +00:00
Hugo van Kemenade
9c54248e4f
[3.12] Add zizmor to pre-commit and fix most findings (GH-127749) (#127788)
(cherry picked from commit ae31df354d)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2024-12-10 14:57:27 +00:00
Hugo van Kemenade
381eb04c17
[3.12] Add zizmor to pre-commit and fix most findings (GH-127749) (#127788)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2024-12-10 15:55:00 +02:00
Miss Islington (bot)
8159d0c39e
[3.12] gh-101100: Fix sphinx warnings in whatsnew/3.0.rst (GH-127662) (#127784)
Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-12-10 10:52:22 +00:00
Miss Islington (bot)
8b4e7f8ec0
[3.12] gh-127552: Remove comment questioning 4-digit restriction for ‘Y’ in datetime.strptime patterns (GH-127590) (#127649)
gh-127552: Remove comment questioning 4-digit restriction for ‘Y’ in datetime.strptime patterns (GH-127590)

The code has required 4 digits for the year since its inclusion in the stdlib in 2002 (over 22 years ago as of this commit).
(cherry picked from commit 51cfa569e3)

Co-authored-by: Beomsoo Kim <beoms424@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-10 09:20:54 +01:00
Miss Islington (bot)
e881dd1c46
[3.12] gh-126775: make linecache.checkcache threadsafe and GC re-entrency safe (GH-126776) (#127779)
gh-126775: make linecache.checkcache threadsafe and GC re-entrency safe (GH-126776)

(cherry picked from commit 2233c303e4)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
2024-12-10 08:02:22 +00:00
Miss Islington (bot)
fa935225a4
gh-127732: Add Windows Server 2025 detection to platform module (GH-127733)
(cherry picked from commit 5eb7fd4d0f)

Co-authored-by: Wulian <1055917385@qq.com>
2024-12-09 12:42:37 +00:00
Miss Islington (bot)
5f5624ddc8
[3.12] gh-127734: improve signature of urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ (GH-127735) (#127745)
gh-127734: improve signature of `urllib.request.HTTPPasswordMgrWithPriorAuth.__init__` (GH-127735)

improve signature of urllib.request.HTTPPasswordMgrWithPriorAuth.__init__
(cherry picked from commit a03efb533a)

Co-authored-by: Stephen Morton <git@tungol.org>
2024-12-08 12:16:03 -08:00
Miss Islington (bot)
87f912ac18
[3.12] Give poplib.POP3.rpop a proper docstring (GH-127370) (#127722)
Give `poplib.POP3.rpop` a proper docstring (GH-127370)

Previously `poplib.POP3.rpop` had a "Not sure what this does" docstring, now it has been fixed.
(cherry picked from commit 27d0d21413)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2024-12-07 16:33:04 +00:00
Miss Islington (bot)
cd46fb6006
[3.12] gh-101100: amend references starting with !~ in gh-127054 (GH-127684) (#127693)
gh-101100: amend references starting with `!~` in gh-127054 (GH-127684)
(cherry picked from commit 77a61c0465)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2024-12-06 14:19:52 +00:00
Miss Islington (bot)
9aa0deb2ee
[3.12] gh-127655: Ensure _SelectorSocketTransport.writelines pauses the protocol if needed (GH-127656) (#127664)
gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol if needed (GH-127656)

Ensure `_SelectorSocketTransport.writelines` pauses the protocol if it reaches the high water mark as needed.
(cherry picked from commit e991ac8f20)

Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-06 10:42:40 +05:30