gh-107219: Fix concurrent.futures terminate_broken() (GH-109244)
Fix a race condition in concurrent.futures. When a process in the
process pool was terminated abruptly (while the future was running or
pending), close the connection write end. If the call queue is
blocked on sending bytes to a worker process, closing the connection
write end interrupts the send, so the queue can be closed.
Changes:
* _ExecutorManagerThread.terminate_broken() now closes
call_queue._writer.
* multiprocessing PipeConnection.close() now interrupts
WaitForMultipleObjects() in _send_bytes() by cancelling the
overlapped operation.
(cherry picked from commit a9b1f84790)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-50644: Forbid pickling of codecs streams (GH-109180)
Attempts to pickle or create a shallow or deep copy of codecs streams
now raise a TypeError.
Previously, copying failed with a RecursionError, while pickling
produced wrong results that eventually caused unpickling to fail with
a RecursionError.
(cherry picked from commit d6892c2b92)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Check the result of PySet_Contains() for error in Python/symtable.c (GH-109146)
(cherry picked from commit 87a7faf6b6)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-104690: thread_run() checks for tstate dangling pointer (#109056)
thread_run() of _threadmodule.c now calls
_PyThreadState_CheckConsistency() to check if tstate is a dangling
pointer when Python is built in debug mode.
Rename ceval_gil.c is_tstate_valid() to
_PyThreadState_CheckConsistency() to reuse it in _threadmodule.c.
(cherry picked from commit f63d37877a)
gh-88943: Improve syntax error for non-ASCII character that follows a numerical literal (GH-109081)
It now points on the invalid non-ASCII character, not on the valid numerical literal.
(cherry picked from commit b2729e93e9)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-109190: Announce final release in What's New in Python 3.12 (GH-110117)
Prepare What's New in Python 3.12 for final release
(cherry picked from commit 6139bf5e0c)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Docs: bump Pygments to fix contrast ratios to meet WCAG AA guidelines (GH-110208)
(cherry picked from commit 9cb8927bfc)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
GH-92584: Move installation schemes overview to sysconfig docs (GH-108018)
* Add new installation path functions subsection
* Add content from install/index to sysconfig
* Fix table
* Update note about installers
* Clean up the list of schemes, remove references to Distutils
(cherry picked from commit f16e81f368)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-109991: Update Windows build to use OpenSSL 3.0.11 (GH-110054)
(cherry picked from commit cf4c297256)
Co-authored-by: Zachary Ware <zach@python.org>
gh-101100: Fix references to ``URLError`` and ``HTTPError`` in ``howto/urllib2.rst`` (GH-107966)
(cherry picked from commit bfd94ab9e9)
Co-authored-by: Yuki K <drsuaimqjgar@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
gh-101100: Fix Sphinx warnings in `tutorial/controlflow.rst` (GH-109424)
(cherry picked from commit 8898a8683b)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-109991: Update GitHub CI workflows to use OpenSSL 3.0.11 and multissltests to use 1.1.1w, 3.0.11, and 3.1.3. (gh-110002)
(cherry picked from commit c88037d137)
Co-authored-by: Ned Deily <nad@python.org>
no-issue: Fix a typo in the parameter name of random.expovariate. (gh-109902)
(cherry picked from commit 8100612bac)
Co-authored-by: lohaswinner <lohaswinner@gmail.com>
gh-107298: Document PyMODINIT_FUNC macro (GH-109236)
Document PyMODINIT_FUNC macro.
Remove links to PyAPI_FUNC() and PyAPI_DATA() macros since they are
not documented. These macros should only be used to define the Python
C API. They should not be used outside Python code base.
(cherry picked from commit d7a27e527d)
Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-109889: comment out assertion indicating a failed optimization of a redundant NOP
* comment out the function to avoid warnings on it being unused
gh-109823: Adjust labels in compiler when removing an empty basic block which is a jump target (GH-109839)
(cherry picked from commit d73c12b88c)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
GH-109190: Copyedit 3.12 What's New: Use the present tense (GH-109754)
(cherry picked from commit 4e478534d7)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
GH-109190: Copyedit 3.12 What's New: Increase the prominence of the setuptools removal (GH-109768)
(cherry picked from commit 09a73d50f6)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
GH-109190: Copyedit 3.12 What's New: Use the ``:file:`` role (GH-109756)
(cherry picked from commit 8d365b60ba)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* gh-100228: Document the os.fork threads DeprecationWarning. (GH-109767)
Document the `os.fork` posix threads detected `DeprecationWarning` in 3.12 What's New, os, multiprocessing, and concurrent.futures docs.
Many reviews and doc cleanup edits by Adam & Hugo. 🥳
(cherry picked from commit 5e7ea95d9d)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* link to the discussion thread from whatsnew
Include the link to the discussion in the what's new text per @malemberg's comment on. https://github.com/python/cpython/pull/109767
(i'll follow up with a PR to main to include this edit there as well)
---------
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
GH-95913: Add the release date for Python 3.11 (GH-109750)
(cherry picked from commit b10de68c6c)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>