]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
10 days agogh-88647: Fix tkinter config() docs for synonym options (GH-153544)
Serhiy Storchaka [Sat, 11 Jul 2026 08:13:37 +0000 (11:13 +0300)] 
gh-88647: Fix tkinter config() docs for synonym options (GH-153544)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
10 days agogh-151540: Use a selector event loop in the happy-eyeballs tests (#153375)
Jakob Rossi [Sat, 11 Jul 2026 07:17:42 +0000 (03:17 -0400)] 
gh-151540: Use a selector event loop in the happy-eyeballs tests (#153375)

10 days agogh-50409: Modernize tkinter.PanedWindow.paneconfigure() (GH-152399)
Serhiy Storchaka [Sat, 11 Jul 2026 06:01:54 +0000 (09:01 +0300)] 
gh-50409: Modernize tkinter.PanedWindow.paneconfigure() (GH-152399)

Rename the first parameter of paneconfigure() (and its paneconfig alias)
from 'tagOrId' to 'child', for consistency with add(), remove() and
panecget() -- PanedWindow panes are child widgets, not tagged items.  The
old 'tagOrId' keyword still works but raises DeprecationWarning.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
10 days agogh-152638: Deprecate tkinter.filedialog.askopenfiles() (GH-152647)
Serhiy Storchaka [Sat, 11 Jul 2026 05:53:02 +0000 (08:53 +0300)] 
gh-152638: Deprecate tkinter.filedialog.askopenfiles() (GH-152647)

Opening several files at once is error-prone, and the returned list
cannot be used in a "with" statement.  Iterate over the names returned
by askopenfilenames() and open them one by one instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
10 days agogh-72880: Add tkinter.fontchooser -- interface to the font selection dialog (GH-153255)
Serhiy Storchaka [Sat, 11 Jul 2026 05:50:08 +0000 (08:50 +0300)] 
gh-72880: Add tkinter.fontchooser -- interface to the font selection dialog (GH-153255)

The FontChooser class wraps the "tk fontchooser" command.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
10 days agogh-153259: Add tkinter.systray -- system tray icon and notifications (GH-153260)
Serhiy Storchaka [Sat, 11 Jul 2026 05:34:13 +0000 (08:34 +0300)] 
gh-153259: Add tkinter.systray -- system tray icon and notifications (GH-153260)

Add the tkinter.systray module with the SysTrayIcon class wrapping the
"tk systray" command and the notify() function wrapping "tk sysnotify"
(Tk 8.7/9.0 and newer).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
10 days agogh-153256: Add tk_print() methods to tkinter Canvas and Text (GH-153257)
Serhiy Storchaka [Sat, 11 Jul 2026 05:12:52 +0000 (08:12 +0300)] 
gh-153256: Add tk_print() methods to tkinter Canvas and Text (GH-153257)

The native print dialog (the "tk print" command, Tk 8.7/9.0+) only
supports canvas and text widgets, so expose it as a method of Canvas
and Text rather than of Misc.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
11 days agogh-153333: Read tkinter profile scripts with the source file's encoding (GH-153334)
tonghuaroot (童话) [Sat, 11 Jul 2026 04:42:35 +0000 (12:42 +0800)] 
gh-153333: Read tkinter profile scripts with the source file's encoding (GH-153334)

Tk.readprofile ran the user's ~/.CLASS.py and ~/.BASE.py scripts with
exec(open(path).read()), decoding them with the locale encoding.  Read
them in binary mode so exec() honors each script's own coding cookie.

11 days agogh-152216: Update bundled expat to 2.8.2 (GH-152234)
Stan Ulbrych [Fri, 10 Jul 2026 18:40:12 +0000 (20:40 +0200)] 
gh-152216: Update bundled expat to 2.8.2 (GH-152234)

* Update bundled expat to 2.8.2
* `make regen-sbom`
* Update download URL
* Drop warnings (yay!)

11 days agogh-153300: Reuse PYCONFIG_SPEC in config_set_global_vars() (#153471)
Victor Stinner [Fri, 10 Jul 2026 17:59:27 +0000 (19:59 +0200)] 
gh-153300: Reuse PYCONFIG_SPEC in config_set_global_vars() (#153471)

No longer hardcode global configuration variables. Use the
PyConfigGlobalVar member of PYCONFIG_SPEC.

11 days agogh-151914: Reorganize the curses entries in What's New in Python 3.16 (GH-153397)
Serhiy Storchaka [Fri, 10 Jul 2026 17:51:16 +0000 (20:51 +0300)] 
gh-151914: Reorganize the curses entries in What's New in Python 3.16 (GH-153397)

Order the curses entries from the most important and general to the more
specialized: wide-character and complexchar/complexstr support first, then
multiple-terminal support, attributes and colors, screen and window management,
input handling, and finally introspection.  The curses.textpad.Textbox entry,
belonging to a separate submodule, moves to the end.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
11 days agogh-59396: Add use_ttk parameter to tkinter ScrolledText (GH-153119)
Serhiy Storchaka [Fri, 10 Jul 2026 17:16:53 +0000 (20:16 +0300)] 
gh-59396: Add use_ttk parameter to tkinter ScrolledText (GH-153119)

ScrolledText gained a keyword-only use_ttk parameter to build the
surrounding frame and the vertical scroll bar from the themed
tkinter.ttk widgets instead of the classic tkinter widgets.  The
classic widgets remain the default.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
11 days agogh-116946: Implement the GC protocol for _tkinter tkapp and tktimertoken (GH-152310)
Serhiy Storchaka [Fri, 10 Jul 2026 16:44:44 +0000 (19:44 +0300)] 
gh-116946: Implement the GC protocol for _tkinter tkapp and tktimertoken (GH-152310)

The _tkinter.tkapp and _tkinter.tktimertoken types never implemented the
garbage collector protocol, so reference cycles through an interpreter's
trace function or a timer handler's callback could not be collected.

A pending timer is kept alive by the Tcl event loop, which fires it even
after the Python token is dropped, so it is treated as a GC root (only its
callback is traversed) and collecting it never cancels a live timer.  The
GC slots use a plain cast rather than the type-checking macro, since the
collector may visit a surviving object at shutdown after module clearing
has reset the global type pointers.  Deallocation cancels any pending timer
so its callback cannot run on freed memory.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
11 days agogh-143070: Use "+" instead of "!" in automatically generated tkinter widget names...
Serhiy Storchaka [Fri, 10 Jul 2026 16:36:12 +0000 (19:36 +0300)] 
gh-143070: Use "+" instead of "!" in automatically generated tkinter widget names (GH-151975)

The "!" prefix has a special meaning in the tag expressions of the
canvas and text widgets ("!", "&&", "||", "^" and parentheses), so an
automatically generated widget name could not be used as a tag.  "+" has
no special meaning there, nor in option database patterns or Tcl lists,
and a user is very unlikely to start an explicit name with it.

11 days agogh-153513: Remove redundant conversions in tkinter tests (GH-153520)
Serhiy Storchaka [Fri, 10 Jul 2026 16:04:49 +0000 (19:04 +0300)] 
gh-153513: Remove redundant conversions in tkinter tests (GH-153520)

Now that index, window, parsedVarName and pixel options are returned as
str, int or float, drop the str()/int()/float() wrappers that only
worked around Tcl_Obj results.  The generated test_configure_* tests now
also check that int- and float-valued options are returned as numbers.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
11 days agogh-153494: Encode imaplib search criteria to the declared CHARSET (GH-153495)
Serhiy Storchaka [Fri, 10 Jul 2026 15:42:07 +0000 (18:42 +0300)] 
gh-153494: Encode imaplib search criteria to the declared CHARSET (GH-153495)

IMAP4.search(), sort(), thread() and the uid SORT/THREAD variants now encode
str search criteria to the declared charset, so international search text can
be passed as ordinary str.  A criterion passed as bytes is sent unchanged, for
use with a charset that Python has no codec for.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
11 days agogh-153513: Return str and numbers for more Tcl object types in _tkinter (GH-153514)
Serhiy Storchaka [Fri, 10 Jul 2026 14:29:53 +0000 (17:29 +0300)] 
gh-153513: Return str and numbers for more Tcl object types in _tkinter (GH-153514)

FromObj() now returns str for the "index", "window", "nsName" and
"parsedVarName" object types, whose internal representation is only a
context-bound lookup with nothing worth preserving in a Tcl_Obj.  An
"index" value is one of a small fixed set of enumeration keywords, so
its str is interned.

A "pixel" screen distance with no unit suffix is screen independent and
is now returned as an int or float.  A distance with an m/c/i/p suffix
needs a Tk_Window to be resolved and is kept as a Tcl_Obj, as are the
"dict" and the resource types "color", "border", "font" and "cursor".

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
11 days agogh-151213: Fix asyncio tools permission requirements link (#153493)
Bartosz Sławecki [Fri, 10 Jul 2026 13:54:18 +0000 (15:54 +0200)] 
gh-151213: Fix asyncio tools permission requirements link (#153493)

11 days agogh-151669: Normalize symlink targets in tarfile.TarFile.gettarinfo() (GH-151671)
Daniele Nicolodi [Fri, 10 Jul 2026 13:53:01 +0000 (15:53 +0200)] 
gh-151669: Normalize symlink targets in tarfile.TarFile.gettarinfo() (GH-151671)

This applies a normalization when creating members vrom the filesystem,
 complementary to the one added to tarfile.TarFile.extract() in gh-138309
that does it in the other direction.
This solves an issue with round-tripping through the filesystem.

11 days agogh-153502: Add uid parameter to imaplib command methods (GH-153508)
Serhiy Storchaka [Fri, 10 Jul 2026 12:08:11 +0000 (15:08 +0300)] 
gh-153502: Add uid parameter to imaplib command methods (GH-153508)

Add a keyword-only uid=False argument to IMAP4.copy(), move(), fetch(),
store(), search(), sort(), thread() and expunge(), selecting the UID
variant of the command as a shorthand for uid().  expunge() also gains
an optional message_set argument, required for UID EXPUNGE.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
11 days agogh-153438: Update NuGet download URL (GH-153482)
Harjoth Khara [Fri, 10 Jul 2026 11:13:08 +0000 (04:13 -0700)] 
gh-153438: Update NuGet download URL (GH-153482)

11 days agogh-151942: Fix all Sphinx nitpicks in the Python 2.4 What's New (#153116)
Stan Ulbrych [Fri, 10 Jul 2026 10:18:15 +0000 (12:18 +0200)] 
gh-151942: Fix all Sphinx nitpicks in the Python 2.4 What's New (#153116)

11 days agogh-151942: Fix all Sphinx nitpicks in the 2.5 What's New (#153120)
Stan Ulbrych [Fri, 10 Jul 2026 10:08:31 +0000 (12:08 +0200)] 
gh-151942: Fix all Sphinx nitpicks in the 2.5 What's New (#153120)

11 days agogh-153201: Make TSan CI mandatory (#153491)
Kumar Aditya [Fri, 10 Jul 2026 09:36:26 +0000 (15:06 +0530)] 
gh-153201: Make TSan CI mandatory (#153491)

11 days agogh-145633: Allow PyFloat_Pack8 & PyFloat_UnPack* to fail in future CPython versions...
Petr Viktorin [Fri, 10 Jul 2026 08:35:35 +0000 (10:35 +0200)] 
gh-145633: Allow PyFloat_Pack8 & PyFloat_UnPack* to fail in future CPython versions (GH-153440)

12 days agogh-153062: Fix a crash iterating itertools.tee on the free-threaded build (gh-153063)
tonghuaroot (童话) [Fri, 10 Jul 2026 02:38:58 +0000 (10:38 +0800)] 
gh-153062: Fix a crash iterating itertools.tee on the free-threaded build (gh-153063)

itertools.tee branches share a linked list of teedataobject cells.  On the free-threaded build, iterating one branch from multiple threads, or iterating sibling branches concurrently, raced on the shared cells and each branch's position, corrupting refcounts and crashing.

Lock each teedataobject while reading, extending, or clearing it, and snapshot each branch's position under the tee object's own lock, revalidating before advancing, so the two locks are never nested.  Concurrent iteration of one tee is undefined and may raise RuntimeError as documented, but no longer crashes.

The free-threading snapshot and revalidation add per-element overhead on the default build, where the GIL already serializes access. Guard that path under Py_GIL_DISABLED so the default build keeps the original iteration and the free-threaded path is unchanged.

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
12 days agogh-152132: Test Py_CompileString() in test_capi.test_run (#153470)
Victor Stinner [Fri, 10 Jul 2026 01:36:31 +0000 (03:36 +0200)] 
gh-152132: Test Py_CompileString() in test_capi.test_run (#153470)

PyRun functions now raises ValueError if the start argument is
invalid.

* Add Modules/_testlimitedcapi/run.c.
* Rename _Py_CompileStringObjectWithModule() to
  _Py_CompileStringObject().

12 days agogh-152132: Enhance Py_RunMain() and fix bugs (#153461)
Victor Stinner [Thu, 9 Jul 2026 23:29:53 +0000 (01:29 +0200)] 
gh-152132: Enhance Py_RunMain() and fix bugs (#153461)

* Check for signals more often. Previously, a pending exception could
  be removed by PyErr_Clear().
* Only call _PyInterpreterState_SetNotRunningMain() if
  _PyInterpreterState_SetRunningMain() has been called.
* Add pymain_error() and pyrun_error(): write the error message to
  sys.stderr instead of the C stream stderr.
* Convert _PyPathConfig_UpdateGlobal() PyStatus error to an
  exception.
* Simplify pymain_run_startup(): avoid strerror() which is decoded
  from the wrong encoding. Instead display the exception, Py_fopen()
  raises an OSError with the path object (and can raise other exceptions).
* Add pymain_set_path0() function.
* Add _PySys_FormatV() function.

12 days agoUse enums for pycore_uop_ids.h. (gh-153351)
Neil Schemenauer [Thu, 9 Jul 2026 22:08:36 +0000 (15:08 -0700)] 
Use enums for pycore_uop_ids.h. (gh-153351)

This generally reduces the sizes of diffs when uops are added or
removed.  It also helps avoid merge conflicts.

12 days agogh-98894: Quote test_dtrace tracer subcommands (#152901)
stratakis [Thu, 9 Jul 2026 20:43:54 +0000 (22:43 +0200)] 
gh-98894: Quote test_dtrace tracer subcommands (#152901)

Use shlex.join() when building tracer -c command strings
for avoiding issues with spaces.

12 days agogh-121608: Fix test_samply_profiler: only check samply once (#153424)
Victor Stinner [Thu, 9 Jul 2026 19:27:40 +0000 (21:27 +0200)] 
gh-121608: Fix test_samply_profiler: only check samply once (#153424)

Only run samply_command_works() once. Remove also dead code.

12 days agogh-152769: Enable perf trampoline on musl (Alpine Linux) (#152774)
Xiaowei Lu [Thu, 9 Jul 2026 19:17:40 +0000 (03:17 +0800)] 
gh-152769: Enable perf trampoline on musl (Alpine Linux) (#152774)

12 days agogh-152132: Fix Py_RunMain() to return an exit code (#153446)
Victor Stinner [Thu, 9 Jul 2026 18:28:15 +0000 (20:28 +0200)] 
gh-152132: Fix Py_RunMain() to return an exit code (#153446)

* Fix Py_RunMain() to return an exit code, rather than calling
  Py_Exit(), when running a script, a command, or the REPL.
* _PyRun_SimpleFile() now logs errors to stderr, for example if setting
  __main__.__file__ fails.
* Add tests on Py_RunMain() exitcode.
* Rename functions:

  * _PyRun_SimpleStringFlagsWithName() => _PyRun_SimpleString()
  * _PyRun_SimpleFileObject() => _PyRun_SimpleFile()
  * _PyRun_AnyFileObject() => _PyRun_AnyFile()
  * _PyRun_InteractiveLoopObject() => _PyRun_InteractiveLoop()

* Change _PyRun_SimpleString(), _PyRun_SimpleFile(), _PyRun_AnyFile() and
  _PyRun_InteractiveLoop() return type to PyObject*.
* pymain_repl() now displays the error if PySys_Audit() or
  import _pyrepl failed.
* PyRun_SimpleFileExFlags() and PyRun_AnyFileExFlags() now log
  PyUnicode_DecodeFSDefault() error. So these functions can no longer
  return -1 with an exception set.

12 days agogh-146531: Broaden `wm_iconbitmap` skip on macOS 26 Intel (#153348)
Hugo van Kemenade [Thu, 9 Jul 2026 18:23:31 +0000 (21:23 +0300)] 
gh-146531: Broaden `wm_iconbitmap` skip on macOS 26 Intel (#153348)

12 days agogh-152905: Decode LC_TIME items in nl_langinfo() from glibc wide data (GH-152911)
Serhiy Storchaka [Thu, 9 Jul 2026 17:36:08 +0000 (20:36 +0300)] 
gh-152905: Decode LC_TIME items in nl_langinfo() from glibc wide data (GH-152911)

On glibc, locale.nl_langinfo() now decodes the LC_TIME text items from the
wide (_NL_W*) locale data, independently of the LC_CTYPE encoding.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
12 days agogh-152997: Support system locale encodings via an iconv-based codec (GH-153001)
Serhiy Storchaka [Thu, 9 Jul 2026 17:01:32 +0000 (20:01 +0300)] 
gh-152997: Support system locale encodings via an iconv-based codec (GH-153001)

Where the C library provides iconv(), the codecs module now exposes every
encoding iconv() knows but Python has no built-in codec for -- the POSIX
counterpart of the Windows code-page support.  Use it by name (e.g.
"cp1133"), or with an "iconv:" prefix to force it over a built-in codec.

The codec is a last-resort search function and never shadows a built-in.
Both directions pivot through native-endian UTF-32, keeping one input unit
per code point so error handlers get the exact string position.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
12 days agogh-153444: Fix compile warning in `Modules/_interpchannelsmodule.c` (#153445)
sobolevn [Thu, 9 Jul 2026 16:08:29 +0000 (19:08 +0300)] 
gh-153444: Fix compile warning in `Modules/_interpchannelsmodule.c` (#153445)

12 days agogh-49555: Support international mailbox names in imaplib (GH-153391)
Serhiy Storchaka [Thu, 9 Jul 2026 16:02:56 +0000 (19:02 +0300)] 
gh-49555: Support international mailbox names in imaplib (GH-153391)

Non-ASCII mailbox names are now encoded as modified UTF-7 (RFC 3501,
section 5.1.3), so they can be passed as an ordinary str.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
12 days agogh-90092: Fix test_curses when stdin is write-only (e.g. under nohup) (GH-153420)
Serhiy Storchaka [Thu, 9 Jul 2026 15:43:26 +0000 (18:43 +0300)] 
gh-90092: Fix test_curses when stdin is write-only (e.g. under nohup) (GH-153420)

newterm() needs a readable input fd, but nohup can leave stdin write-only.
Fall back to the output fd, as already done when stdin has no fileno.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
12 days agogh-153422: Return bool from some tkinter query methods (GH-153429)
Serhiy Storchaka [Thu, 9 Jul 2026 14:13:42 +0000 (17:13 +0300)] 
gh-153422: Return bool from some tkinter query methods (GH-153429)

The winfo_exists(), winfo_ismapped() and winfo_viewable() methods of
tkinter widgets and Text.edit_modified() now return a bool instead of an
integer or, depending on wantobjects, a string.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
12 days agogh-151292: Change `total_samples:u32` in the binary format to `total_samples:u64...
Maurycy Pawłowski-Wieroński [Thu, 9 Jul 2026 13:59:28 +0000 (15:59 +0200)] 
gh-151292: Change `total_samples:u32` in the binary format to `total_samples:u64` (#153425)

12 days agogh-153406: Raise ValueError, not OverflowError, for out-of-range dates in email.utils...
tonghuaroot (童话) [Thu, 9 Jul 2026 13:58:56 +0000 (21:58 +0800)] 
gh-153406: Raise ValueError, not OverflowError, for out-of-range dates in email.utils.parsedate_to_datetime (#153407)

email.utils.parsedate_to_datetime documented that it raises ValueError for an invalid date, but it leaked OverflowError when the parsed year or timezone offset was too large for the datetime and timedelta constructors, and that OverflowError also escaped the modern header parsing path since DateHeader.parse only caught ValueError. Wrap the datetime and timezone construction so an OverflowError is re-raised as a ValueError with the original chained as the cause, which restores the documented contract and lets the existing header handler record an InvalidDateDefect instead of raising.

12 days agogh-153417: Fix BytesWarning in imaplib error messages for bytes arguments (GH-153423)
Serhiy Storchaka [Thu, 9 Jul 2026 13:51:45 +0000 (16:51 +0300)] 
gh-153417: Fix BytesWarning in imaplib error messages for bytes arguments (GH-153423)

IMAP4.select() and IMAP4.uid() formatted the mailbox and command argument
with %s in their error messages, which raised BytesWarning under -bb when the
argument was bytes and masked the real error.  Use %r instead, which is safe
for bytes and also quotes the value.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
12 days agogh-152132: Test all PyRun functions in test_capi.test_run (#153352)
Victor Stinner [Thu, 9 Jul 2026 10:50:40 +0000 (12:50 +0200)] 
gh-152132: Test all PyRun functions in test_capi.test_run (#153352)

PyRun_InteractiveOneObjectEx() now raises TypeError if the second
parameter type is not str.

12 days agogh-69134: Harden NotebookTest.test_traversal (GH-153403)
Serhiy Storchaka [Thu, 9 Jul 2026 09:54:13 +0000 (12:54 +0300)] 
gh-69134: Harden NotebookTest.test_traversal (GH-153403)

identify(5, 5) could run before the notebook reached its requested size,
so the pixel fell outside the first tab and returned ''.  Guard it with a
new opt-in wait_until_mapped(full_size=True).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
12 days agogh-151757: Skip curses variation-selector test on older macOS (GH-153344)
Serhiy Storchaka [Thu, 9 Jul 2026 06:28:32 +0000 (09:28 +0300)] 
gh-151757: Skip curses variation-selector test on older macOS (GH-153344)

Older macOS reports a variation selector as a spacing character (wcwidth()
returns 1) instead of a zero-width combining mark, so curses cannot put it in
the same cell as its base.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
12 days agogh-153380: Adapt ttk tests to Tk 9.1 changes (GH-153381)
Serhiy Storchaka [Thu, 9 Jul 2026 06:07:34 +0000 (09:07 +0300)] 
gh-153380: Adapt ttk tests to Tk 9.1 changes (GH-153381)

- selectmode: new 'single' and 'multiple' modes
- set(): includes the tree column '#0'
- insert()/selection(): item ids keep the passed value's type
- heading_callback: avoid a double click on the second click
- theme_create_image: don't assert the exact (now scaled) width

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
12 days agogh-130578: clarify urllib.parse.quote parameter defaults behavior (#130598)
Kanishk Pachauri [Thu, 9 Jul 2026 05:11:36 +0000 (10:41 +0530)] 
gh-130578: clarify urllib.parse.quote parameter defaults behavior (#130598)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
13 days agogh-47005: fix do_open() to let regular headers override unredirected … (#146506)
CHINMAY [Thu, 9 Jul 2026 03:40:18 +0000 (20:40 -0700)] 
gh-47005: fix do_open() to let regular headers override unredirected … (#146506)

* gh-47005: fix do_open() to let regular headers override unredirected headers

AbstractHTTPHandler.do_open() was building the request header dict by
starting with unredirected_hdrs and only inserting regular headers that
were not already present, giving unredirected headers priority.  This
contradicts get_header() and header_items(), both of which give regular
headers the higher priority.

Fix by unconditionally updating with req.headers so that a header set
via add_header() always overrides one set via add_unredirected_header().

---------

Co-authored-by: Senthil Kumaran <senthil@python.org>
13 days agogh-151213: Document asyncio debugging tools (#151392)
Bartosz Sławecki [Wed, 8 Jul 2026 23:17:05 +0000 (01:17 +0200)] 
gh-151213: Document asyncio debugging tools (#151392)

13 days agogh-119592: gh-152967: Fix ProcessPoolExecutor stranding submitted work when a max_tas...
Gregory P. Smith [Wed, 8 Jul 2026 20:06:20 +0000 (13:06 -0700)] 
gh-119592: gh-152967: Fix ProcessPoolExecutor stranding submitted work when a max_tasks_per_child worker exits (GH-152978)

gh-119592: Fix ProcessPoolExecutor stranding submitted work when a max_tasks_per_child worker exits

Worker replacement went through the executor object: the manager thread
read executor attributes that shutdown(wait=False) clears concurrently,
and could not replace workers at all once the executor was garbage
collected. A worker exiting at its max_tasks_per_child limit in those
states left the remaining submitted work permanently unexecuted and hung
interpreter exit; the racing case could crash the manager thread.

Replace workers from the executor manager thread using its own state
plus configuration read through the live executor weakref, which
shutdown() never clears:

- After shutdown(wait=False) with the executor still referenced, a
  replacement is spawned and the remaining work is executed as
  documented.
- Once the executor has been garbage collected (gh-152967), or a
  replacement worker cannot be started and no workers remain, the
  remaining futures now fail with BrokenProcessPool instead of never
  resolving.
- A new _force_shutting_down flag stops both spawn paths from starting
  workers that would escape terminate_workers()/kill_workers().

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Reviewed-multiple-times-by: Gregory P. Smith
13 days agogh-61310: Document package precedence over same-named modules (#153211)
YiYi [Wed, 8 Jul 2026 17:28:30 +0000 (01:28 +0800)] 
gh-61310: Document package precedence over same-named modules (#153211)

Co-authored-by: TheD0ubleC <cc@scmd.cc>
Co-authored-by: Stan Ulbrych <stan@python.org>
13 days agogh-153300: Set global configuration variables in PyConfig_Set() (#153301)
Victor Stinner [Wed, 8 Jul 2026 16:56:07 +0000 (18:56 +0200)] 
gh-153300: Set global configuration variables in PyConfig_Set() (#153301)

PyConfig_Set() now also set global configuration variables. For
example, PyConfig_Set("inspect", value) now also sets Py_InspectFlag.

Use PyConfig_Set() in main.c to set the inspect flag. Python code can
now see the updated sys.flags.inspect value.

13 days agogh-46927: Prevent readline from overriding environment variables (GH-153184)
Mathieu Dubois-Briand [Wed, 8 Jul 2026 16:45:15 +0000 (18:45 +0200)] 
gh-46927: Prevent readline from overriding environment variables (GH-153184)

Readline sets COLUMNS and LINES to the terminal size at initialization, and
ncurses prefers those stale variables over an ioctl() query, breaking resize
handling. Set rl_change_environment to 0, when available, so importing
readline no longer modifies the environment.

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
13 days agogh-143750: Compile OpenSSL with TSan for TSan CI (#153316)
Kumar Aditya [Wed, 8 Jul 2026 15:15:31 +0000 (20:45 +0530)] 
gh-143750: Compile OpenSSL with TSan for TSan CI (#153316)

Co-authored-by: Sam Gross <colesbury@gmail.com>
13 days agogh-153298: Fix data race in `GenericAlias` parameter initialization on FT (#153318)
sobolevn [Wed, 8 Jul 2026 14:57:22 +0000 (17:57 +0300)] 
gh-153298: Fix data race in `GenericAlias` parameter initialization on FT (#153318)

13 days agogh-153339: Remove extra skip in `test_generators.py` (#153340)
sobolevn [Wed, 8 Jul 2026 14:13:24 +0000 (17:13 +0300)] 
gh-153339: Remove extra skip in `test_generators.py` (#153340)

13 days agobpo-42861: Add `next_network` function to ipaddress library (#24180)
777GE90 [Wed, 8 Jul 2026 14:06:55 +0000 (15:06 +0100)] 
bpo-42861: Add `next_network` function to ipaddress library (#24180)

Add `next_network` method that returns the  next closest network of prefix size *next_prefix*. to Lib.ipaddress

---------

Co-authored-by: Faisal Mahmood <killerklient@hotmail.co.uk>
Co-authored-by: Senthil Kumaran <senthil@python.org>
13 days agogh-153083: Defer GC tracking of an array to the end of construction. (gh-153284)
Donghee Na [Wed, 8 Jul 2026 12:27:32 +0000 (21:27 +0900)] 
gh-153083: Defer GC tracking of an array to the end of construction. (gh-153284)

13 days agogh-143990: Do not assume the requested font size in test_font (GH-153322)
Serhiy Storchaka [Wed, 8 Jul 2026 12:12:20 +0000 (15:12 +0300)] 
gh-143990: Do not assume the requested font size in test_font (GH-153322)

On platforms with only bitmap fonts Tk substitutes the nearest
available size, so query the resolved size instead of assuming it.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
13 days agogh-86017: Document displayof for Font.actual() and clarify Font.copy() (GH-153288)
Serhiy Storchaka [Wed, 8 Jul 2026 12:00:15 +0000 (15:00 +0300)] 
gh-86017: Document displayof for Font.actual() and clarify Font.copy() (GH-153288)

Explain the displayof argument of tkinter.font.Font.actual() and describe
what Font.copy() returns, including for a wrapped font description.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
13 days agogh-66788: Add the utf-7-imap codec (GH-153149)
Serhiy Storchaka [Wed, 8 Jul 2026 11:55:27 +0000 (14:55 +0300)] 
gh-66788: Add the utf-7-imap codec (GH-153149)

Implement the modified UTF-7 encoding used for international IMAP4
mailbox names (RFC 3501, section 5.1.3).  It differs from UTF-7:
"&" is the shift character ("&-" encodes a literal "&"), "," replaces
"/" in the Base64 alphabet, and all non-printable-ASCII characters are
Base64-encoded.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
13 days agogh-150191: temporarily skip two openssl tests which have internal data races under...
Kumar Aditya [Wed, 8 Jul 2026 11:48:38 +0000 (17:18 +0530)] 
gh-150191: temporarily skip two openssl tests which have internal data races under TSAN (#153320)

13 days agogh-88574: Do not swallow the line after a terminating literal in imaplib (GH-153317)
Serhiy Storchaka [Wed, 8 Jul 2026 11:45:58 +0000 (14:45 +0300)] 
gh-88574: Do not swallow the line after a terminating literal in imaplib (GH-153317)

GH-152751 skipped a spurious blank line after a literal unconditionally,
corrupting a response that ends with a literal (such as a mailbox name
returned by LIST): its empty trailer was mistaken for the blank and the
following line was swallowed.

The blank is now skipped only inside an unclosed parenthesis.  After a
literal that ends the response it instead arrives before the next
response and is skipped there.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
13 days agogh-149740: Remove redundant self.empty() check in asyncio.Queue.get() (#149741)
Timofei [Wed, 8 Jul 2026 10:15:18 +0000 (13:15 +0300)] 
gh-149740: Remove redundant self.empty() check in asyncio.Queue.get() (#149741)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
13 days agogh-153292: Fix data race in `threading.RLock.__repr__` in FT builds (#153299)
sobolevn [Wed, 8 Jul 2026 09:41:38 +0000 (12:41 +0300)] 
gh-153292: Fix data race in `threading.RLock.__repr__` in FT builds (#153299)

13 days agogh-150358: Remove unused _complete_fut attribute from asyncio.StreamWriter (#150359)
Timofei [Wed, 8 Jul 2026 09:24:24 +0000 (12:24 +0300)] 
gh-150358: Remove unused _complete_fut attribute from asyncio.StreamWriter (#150359)

13 days agogh-143990: Preserve the size when creating a Font from a named font (GH-153267)
Serhiy Storchaka [Wed, 8 Jul 2026 08:30:12 +0000 (11:30 +0300)] 
gh-143990: Preserve the size when creating a Font from a named font (GH-153267)

tkinter.font.Font now copies the options of a named font (via "font
configure") instead of the options resolved by "font actual", which
would resolve a size specified in pixels (a negative size) to points.
A font description is still resolved, as it cannot be parsed otherwise.

Font.copy(), which has always been equivalent to constructing a Font
from the original font, is updated to match and now preserves the size
too.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2 weeks agogh-153056: Fix a data race compiling the string.Template pattern in free-threading...
tonghuaroot (童话) [Wed, 8 Jul 2026 00:40:54 +0000 (08:40 +0800)] 
gh-153056: Fix a data race compiling the string.Template pattern in free-threading builds (#153057)

* gh-153056: Fix a data race compiling the string.Template pattern in free-threading builds

Template compiles its substitution pattern lazily and caches it on the class.  On the free-threaded build two concurrent first uses could race: a thread that observed the pattern another thread had just compiled would try to recompile it, and re.compile() rejects flags on an already-compiled pattern, raising a spurious ValueError.  Return the already-compiled pattern instead.

As a side effect, a subclass that supplies an already-compiled pattern now works too; previously it raised the same ValueError at class definition.

* Trim test comments and NEWS wording

* Document that the pattern attribute accepts a string or a compiled regex

* Comment the three states of pattern and note the documented-behavior fix in NEWS

* Update Doc/library/string.rst

---------

Co-authored-by: Barry Warsaw <barry@python.org>
2 weeks agogh-152586: Make `tempfile.TemporaryFileWrapper` public (#152646)
Aniket [Tue, 7 Jul 2026 21:34:16 +0000 (03:04 +0530)] 
gh-152586: Make `tempfile.TemporaryFileWrapper` public (#152646)

Deprecate old compatibility `tempfile._TemporaryFileWrapper` name, schedule it to be removed in Python 3.21

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 weeks agogh-153133: Fix socket leak in error path of asyncio create_connection (#153134)
Timofei [Tue, 7 Jul 2026 19:23:17 +0000 (22:23 +0300)] 
gh-153133: Fix socket leak in error path of asyncio create_connection (#153134)

2 weeks agogh-153252: Fix error handling in `_PyCompile_CodeGen` (#153253)
sobolevn [Tue, 7 Jul 2026 16:41:05 +0000 (19:41 +0300)] 
gh-153252: Fix error handling in `_PyCompile_CodeGen` (#153253)

2 weeks agoOn Unix, avoid a conversion to wchar_t in getpath.c (#153230)
Victor Stinner [Tue, 7 Jul 2026 16:28:05 +0000 (18:28 +0200)] 
On Unix, avoid a conversion to wchar_t in getpath.c (#153230)

* Replace _Py_wstat() with _Py_stat() in isfile() and isxfile().
* Replace _Py_wfopen() with Py_fopen() in readlines().

2 weeks agogh-152798: update sys.thread_info.lock documentation to match implementation (#153263)
Wojusensei [Tue, 7 Jul 2026 16:13:35 +0000 (00:13 +0800)] 
gh-152798: update sys.thread_info.lock documentation to match implementation (#153263)

2 weeks agogh-153210: Restore accidental `array.ArrayType` removal (#153261)
sobolevn [Tue, 7 Jul 2026 16:09:02 +0000 (19:09 +0300)] 
gh-153210: Restore accidental `array.ArrayType` removal (#153261)

2 weeks agogh-153205: Set `MemoryError` in stackref array conversion (#153206)
An Long [Tue, 7 Jul 2026 16:03:34 +0000 (01:03 +0900)] 
gh-153205: Set `MemoryError` in stackref array conversion (#153206)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2 weeks agogh-150191: Avoid data race in test_sni_callback_race (#150193)
Sam Gross [Tue, 7 Jul 2026 15:52:00 +0000 (11:52 -0400)] 
gh-150191: Avoid data race in test_sni_callback_race (#150193)

2 weeks agoTemporarily allow the TSan (free-threading) job to fail (#152173)
Stan Ulbrych [Tue, 7 Jul 2026 14:59:57 +0000 (16:59 +0200)] 
Temporarily allow the TSan (free-threading) job to fail (#152173)

2 weeks agogh-143990: Allow tkinter.font.Font to wrap a font description (GH-152025)
Serhiy Storchaka [Tue, 7 Jul 2026 09:37:04 +0000 (12:37 +0300)] 
gh-143990: Allow tkinter.font.Font to wrap a font description (GH-152025)

With exists=True and no name, Font now wraps the font description as is,
without creating a new named font, so that it is used without loss of
precision by actual(), measure() and metrics().  Its name attribute is then
the description rather than a string.  Keyword options now override the
corresponding settings of the given font instead of being ignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2 weeks agogh-153227: Use a development version of Pygments (#153228)
Peter Bierma [Tue, 7 Jul 2026 09:08:34 +0000 (05:08 -0400)] 
gh-153227: Use a development version of Pygments (#153228)

2 weeks agogh-153210: Fix `array` module import crash under a memory pressure (#153238)
sobolevn [Tue, 7 Jul 2026 08:25:30 +0000 (11:25 +0300)] 
gh-153210: Fix `array` module import crash under a memory pressure (#153238)

2 weeks agogh-145177: Update Emscripten to 6.0.2 (#153235)
Hood Chatham [Mon, 6 Jul 2026 23:54:16 +0000 (16:54 -0700)] 
gh-145177: Update Emscripten to 6.0.2 (#153235)

Removes the patched `getentropy()` call since it has been included upstream.

2 weeks agogh-140729: Fix the cProfile module when the executed script contains calls to multipr...
Duprat [Mon, 6 Jul 2026 23:39:06 +0000 (01:39 +0200)] 
gh-140729: Fix the cProfile module when the executed script contains calls to multiprocessing.Process (#144715)

Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
2 weeks agogh-153068: Preserve cprofile enable errors (#153070)
An Long [Mon, 6 Jul 2026 23:36:26 +0000 (08:36 +0900)] 
gh-153068: Preserve cprofile enable errors (#153070)

2 weeks agogh-150479: reject CR and LF in email.utils.formataddr (#150480)
metsw24-max [Mon, 6 Jul 2026 20:16:43 +0000 (01:46 +0530)] 
gh-150479: reject CR and LF in email.utils.formataddr (#150480)

2 weeks agogh-150490: Raise PyType_Modified for insertion into split dictionary (take 2) (#152914)
Dino Viehland [Mon, 6 Jul 2026 19:56:32 +0000 (12:56 -0700)] 
gh-150490: Raise PyType_Modified for insertion into split dictionary (take 2) (#152914)

Raise PyType_Modified for insertion into split dictionary - now with better locking discipline in free-threaded builds

2 weeks agoSeed pip caches for docs on `main`/`3.x` branches (#153127)
Hugo van Kemenade [Mon, 6 Jul 2026 19:46:22 +0000 (22:46 +0300)] 
Seed pip caches for docs on `main`/`3.x` branches (#153127)

2 weeks agogh-153200: Fix math.isqrt() for int subclasses with overridden comparison operators...
Serhiy Storchaka [Mon, 6 Jul 2026 18:10:23 +0000 (21:10 +0300)] 
gh-153200: Fix math.isqrt() for int subclasses with overridden comparison operators (GH-153203)

The final check-and-correct comparison in the arbitrary precision path
could call a comparison operator overridden in an int subclass.
Compare by value with int's tp_richcompare.

2 weeks agogh-150880: Clarify DirEntry.path construction semantics (GH-153218)
Zain Nadeem [Mon, 6 Jul 2026 17:14:28 +0000 (22:14 +0500)] 
gh-150880: Clarify DirEntry.path construction semantics (GH-153218)

2 weeks agogh-152433: Allow _ssl module to build for Windows UWP API set (GH-152791)
thexai [Mon, 6 Jul 2026 16:32:36 +0000 (18:32 +0200)] 
gh-152433: Allow _ssl module to build for Windows UWP API set (GH-152791)

2 weeks agogh-152785: Upgrade Ubuntu from 24.04 to 26.04 in GitHub Actions (#152717)
Victor Stinner [Mon, 6 Jul 2026 15:44:21 +0000 (17:44 +0200)] 
gh-152785: Upgrade Ubuntu from 24.04 to 26.04 in GitHub Actions (#152717)

* Replace "ubuntu-24.04" with "ubuntu-26.04".
* Replace "ubuntu-latest" with "ubuntu-26.04" for Cross build Linux.
* Replace "ubuntu-latest" with "ubuntu-slim" for small workloads.
* Update ".github/actionlint.yaml" to allow "ubuntu-26.04"
  and "ubuntu-26.04-arm" images.
* Install Ubuntu libmpdec-dev package, rather than installing libmpdec
  from source (tarball).
* No longer run https://apt.llvm.org/llvm.sh, since ubuntu-26.04 provides
  clang-21 by default.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 weeks agoDocs: Link to the `contextlib.chdir` context manager in the `os.chdir` docs (#153152)
Cody Maloney [Mon, 6 Jul 2026 15:40:45 +0000 (08:40 -0700)] 
Docs: Link to the `contextlib.chdir` context manager in the `os.chdir` docs (#153152)

Co-authored-by: Stan Ulbrych <stan@python.org>
2 weeks agogh-152849: Fix `OverflowError` message for out-of-range timestamps in the `time`...
tonghuaroot (童话) [Mon, 6 Jul 2026 14:50:15 +0000 (22:50 +0800)] 
gh-152849: Fix `OverflowError` message for out-of-range timestamps in the `time` module (#152850)

Co-authored-by: Stan Ulbrych <stan@python.org>
2 weeks agogh-148286: Remove invalid test in `test_decodeescape` (#153187)
Stan Ulbrych [Mon, 6 Jul 2026 14:47:55 +0000 (16:47 +0200)] 
gh-148286: Remove invalid test in `test_decodeescape` (#153187)

2 weeks agogh-145098: Use `macos-26[-intel]` instead of `macos-15[-intel]` in `{jit,tail-call...
Hugo van Kemenade [Mon, 6 Jul 2026 14:25:32 +0000 (17:25 +0300)] 
gh-145098: Use `macos-26[-intel]` instead of `macos-15[-intel]` in `{jit,tail-call}.yml` (#153194)

2 weeks agoAdd tests for syntax error messages that had no test coverage (GH-153192)
Serhiy Storchaka [Mon, 6 Jul 2026 13:49:17 +0000 (16:49 +0300)] 
Add tests for syntax error messages that had no test coverage (GH-153192)

"illegal target for annotation" and "cannot use dict unpacking here"
were not tested at all, and "f-string: expecting '!', or ':', or '}'"
was only tested for its t-string variant.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2 weeks agogh-153171: Produce specialized syntax errors for 'not' after an operator in more...
Serhiy Storchaka [Mon, 6 Jul 2026 10:00:05 +0000 (13:00 +0300)] 
gh-153171: Produce specialized syntax errors for 'not' after an operator in more positions (GH-153175)

Move the invalid_factor rule from term to factor and the
invalid_arithmetic rule from shift_expr to sum, so that they are
tried at all positions where the invalid construct can occur.
Previously a generic "invalid syntax" error was reported for
constructs like "1 << 2 + not x" or "1 * + not x".

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2 weeks agogh-145855: Remove the DELETE_ATTR bytecode (GH-146216)
An Long [Mon, 6 Jul 2026 09:41:47 +0000 (18:41 +0900)] 
gh-145855: Remove the DELETE_ATTR bytecode (GH-146216)

2 weeks agogh-148765: Fix description of *include_hidden* parameter in `glob.glob()` docs (...
Eoin Shaughnessy [Mon, 6 Jul 2026 07:44:48 +0000 (08:44 +0100)] 
gh-148765: Fix description of *include_hidden* parameter in `glob.glob()` docs (#148768)

Co-authored-by: Stan Ulbrych <stan@python.org>
2 weeks agogh-152026: Track mark-saving contexts with a counter (GH-153160)
Serhiy Storchaka [Mon, 6 Jul 2026 05:22:37 +0000 (08:22 +0300)] 
gh-152026: Track mark-saving contexts with a counter (GH-153160)

Replace the state->repeat checks that guard mark saving and restoring
with an explicit save_marks counter maintained where repeat and
possessive contexts are entered and left.  Each push is now paired
with a pop decided by the same condition.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>