[3.15] gh-148665: Enable socket.shutdown function for emscripten (GH-148666) (#154319)
Re-enable the autoconf check for socket.shutdown on Emscripten, as some
Emscripten environments are able to provide this call.
(cherry picked from commit 20b7e8e50b9a4a92989b36531429f9b51ee0a0bf)
[3.15] gh-154291: Fix socket.has_dualstack_ipv6() on DragonFly BSD (GH-154292) (GH-154299)
On DragonFly BSD setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0) succeeds without
actually clearing the flag, so has_dualstack_ipv6() wrongly returned True.
Verify with getsockopt() that IPV6_V6ONLY was cleared.
(cherry picked from commit c7bbf040e721781be8f11a3b0716220835d4de2f)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
[3.15] gh-154283: Make threading.get_native_id() unique across processes on DragonFly (GH-154287) (GH-154293)
On DragonFly BSD lwp_gettid() is only unique within a process (the main
thread is always LWP 1), so combine it with the process id, like Solaris.
(cherry picked from commit 53597df11e2d9f01ade2529c147df24b49685878)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
[3.15] gh-154289: Fix test_socket.testGetServBy on DragonFly (GH-154290) (GH-154294)
DragonFly lists "echo 4/ddp" before "echo 7/tcp" in /etc/services, like
FreeBSD, so avoid the "echo" service there too.
(cherry picked from commit 96059f9446510f594c4148d53bd1a4e3532af697)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
[3.15] gh-154260: Fix test_flush_parameters on DragonFly BSD (GH-154261) (GH-154269)
DragonFly, like FreeBSD, rejects mmap.flush() with MS_ASYNC|MS_INVALIDATE
(EINVAL). Use str.startswith() so the check also matches DragonFly, whose
sys.platform carries a version suffix.
(cherry picked from commit fc4d93dcf1a01f56fd8ffc35b6d3700c98ffa6c9)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
[3.15] gh-154258: Fix mmap.resize() crash on NetBSD growing a shared anonymous mapping (GH-154259) (GH-154262)
NetBSD mremap() returns a mapping whose grown region is not backed when
growing a shared anonymous mapping, so accessing it crashes. Reject it
with ValueError, as is already done on Linux.
(cherry picked from commit 542b98293108a84fa5d904fb6dcf8bfb5080ec93)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
[3.15] gh-154176: Fix locale.strxfrm() crash on DragonFly BSD (GH-154177) (GH-154217)
Query the result size with a real one-element buffer instead of
wcsxfrm(NULL, s, 0): DragonFly BSD's wcsxfrm() crashes when the
destination is NULL or the size is 0.
(cherry picked from commit f389b03f9f2768342bfd49987a257460d4aa4faf)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
[3.15] gh-127049: fix race condition in asyncio signalling an unrelated process with ThreadedChildWatcher (GH-153810) (#154220)
gh-127049: fix race condition in asyncio signalling an unrelated process with ThreadedChildWatcher (GH-153810)
(cherry picked from commit 2875d1dc913d2d7810465da4bc3899305da5abc7)
[3.15] gh-154046: docs: fix dead link to codahale timing attacks article in secrets.rst (GH-154047) (#154213)
gh-154046: docs: fix dead link to codahale timing attacks article in secrets.rst (GH-154047)
(cherry picked from commit e8042329b6bb2472b16645c559e4223486b85965)
[3.15] gh-119710: fix asyncio Process.wait() to finish on process exit and not wait for closing of pipes (GH-151983) (#154170)
* gh-119710: fix asyncio Process.wait() to finish on process exit and not wait for closing of pipes (GH-151983)
(cherry picked from commit f2521324e6bdf331460abec7c2a88e2d3736b91c)
[3.15] gh-139806: Mention pickle error changes in What's New in 3.14 (GH-154020) (GH-154161)
The gh-122311 changes made pickle.dump() and pickle.dumps() raise
PicklingError for some failures that previously raised AttributeError,
ImportError, ValueError or UnicodeEncodeError, depending on the
implementation.
Add an entry about this in the "Porting to Python 3.14" section.
(cherry picked from commit eb447081ed8182f825fa01953ec87cff41f3d585)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
[3.15] gh-153862: Fix curses window.inch() for non-ASCII characters on a wide build (GH-153863) (GH-154116)
On a wide build, winch() returns the low 8 bits of the character's code
point with no locale conversion, so inch()/mvinch() disagreed with instr()
for a non-ASCII character of an 8-bit locale ('€' under ISO-8859-15 gave
0xAC instead of 0xA4). Re-encode the cell to its locale byte via wctob(),
as ncurses does for getbkgd().
[3.15] gh-153864: Fix curses window.insch() for non-ASCII characters on a wide build (GH-153865) (GH-154117)
On a wide build, winsch() does not locale-decode a byte above 127, unlike
waddch(), so insch() inserted '¤' (U+00A4) instead of '€' for byte 0xA4
under ISO-8859-15. Decode the byte with btowc() and insert it as a wide
character, like addch().
[3.15] gh-154053: Fix compilation of the ssl module against LibreSSL (GH-154054) (GH-154075)
LibreSSL does not provide SSL_CTX_set1_sigalgs_list() or
SSL_CTX_set1_client_sigalgs_list(), added in gh-138252, so _ssl failed to
compile against LibreSSL on 3.15+. Guard the set_server_sigalgs() and
set_client_sigalgs() methods so they raise NotImplementedError on LibreSSL,
and skip the corresponding tests.
(cherry picked from commit 39b058f8ad29238edc8b65406bb1fb0bc3c0020d)
[3.15] gh-153926: Fix documented parameter name for `calendar.calendar` and `calendar.prcal` (GH-153927) (#153937)
gh-153926: Fix documented parameter name for `calendar.calendar` and `calendar.prcal` (GH-153927)
gh-153926: Fix documented parameter name for calendar.calendar and calendar.prcal
calendar.calendar() and calendar.prcal() are bound methods of the
module's TextCalendar instance, whose first parameter is named theyear,
but the documentation named it year, so the documented keyword raised
TypeError. Update the documentation to match the real signature, which
also matches the sibling month() and prmonth() functions.
(cherry picked from commit d12434b4661c6be7430002e66a54d920f7d4ca7f)
[3.15] gh-85943: Fix BytesWarning in the struct format cache under -bb (GH-153627) (GH-153834)
Normalize bytes format strings to str before using them as the cache key,
so that equal str and bytes formats no longer collide and get compared.
(cherry picked from commit 190d2ffbb969ad571fd12d4988b37519091194d5)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
[3.15] gh-151644: Fix data race in sys.setdlopenflags/getdlopenflags under free-threading (gh-151768) (#153790)
gh-151644: Fix data race in sys.setdlopenflags/getdlopenflags under free-threading (gh-151768)
In free-threading builds, concurrent calls to sys.getdlopenflags() and
sys.setdlopenflags() race on interp->imports.dlopenflags. Fix by
using FT_ATOMIC_LOAD_INT_RELAXED / FT_ATOMIC_STORE_INT_RELAXED in
_PyImport_GetDLOpenFlags and _PyImport_SetDLOpenFlags, consistent with
how analogous interpreter-state integer fields (lazy_imports_mode,
pystats_enabled) are protected.
Relaxed ordering is correct here: dlopenflags is a standalone config
integer with no ordering relationship to other memory.
(cherry picked from commit cde31ec135905472f1137dddcc8227af2430d89c)
Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
[3.15] gh-153550: Modernize the older prose sections of the tkinter documentation (GH-153647) (GH-153773)
Refresh the narrative "Tkinter life preserver" and "Handy reference"
sections to match the overhauled reference (gh-86726 and gh-153549).
* Rework "The packer" into a general "Geometry management" section
covering grid, pack and place, and cross-link it with the Grid, Pack
and Place reference classes.
* Rework "The window manager" and "Coupling widget variables", replacing
the dated App(Frame) examples with direct Tk() and ttk examples.
* Replace page-number citations to Ousterhout's book with links to the
relevant Tk man pages.
* Modernize the tkinter.ttk front matter and its Tcl/Tk links, and add
cross-references between the two documents.
* Reconcile the "Packer options" and "Tk option data types" lists with
the reference, and fill in the empty Entry index list.
* Fix the malformed target-selection list in tkinter.dnd.
(cherry picked from commit 93beea7e5a3c5a03253e6812a06f2497505aeb30)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Separate tests for module-level API and for the MimeTypes class.
* Add tests for mimetypes.init() and MimeTypes() with knownfiles and with
explicitly passed files.
Compute probe coordinates from each widget's own realized geometry
instead of hardcoding pixels such as (5, 5) or width - 5, which land on
a different element, or miss it entirely, at a high display scaling.
(cherry picked from commit 87411d0742f070b1424c08b41cf3af49d377b215)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
[3.15] gh-153631: Move to `macos-26` runner for iOS (GH-153632) (#153673)
Switches iOS CI to use the macos-26 runner, and makes a small change to the iOS
build script to improve build stability. xcodebuild doesn't guarantee that the
CoreSimulatorService is running before starting a simulator. If the service
isn't running, xcodebuild reports that no simulators are available, and fails to
start the test app. However, simctl blocks until the simulator is available, and
simctl is used to evaluate the default simulator. So - the iOS build script now
unconditionally determines the default simulator, even if a specific simulator
is requested.
(cherry picked from commit 2dc1a91af801ea896e21f6c6e6cc41f57e8268d9)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>