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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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).
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>
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>
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)
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>
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
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>
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>
Fix typos in `Lib/_pydecimal.py` (GH-127700)
(cherry picked from commit ed037d229f)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
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>
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>
* `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>
(cherry picked from commit a26d27e7ee)
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
(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>
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>
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>
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>
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>
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>