更新日志
更新日志
Python next
Release date: XXXX-XX-XX
Windows
- gh-125550: Enable the 适用于Windows的Python启动器 to detect Python 3.14 installs from the Windows Store.
Tests
- gh-125041: Re-enable skipped tests for zlib on the s390x architecture: only skip checks of the compressed bytes, which can be different between zlib’s software implementation and the hardware-accelerated implementation.
Security
- gh-125140: Remove the current directory from
sys.pathwhen using PyREPL.
Library
-
gh-125451: Fix deadlock when concurrent.futures.ProcessPoolExecutor shuts down concurrently with an error when feeding a job to a worker process.
-
gh-125422: Fixed the bug where pdb and bdb can step into the bottom caller frame.
-
gh-100141: Fixed the bug where pdb will be stuck in an infinite loop when debugging an empty file.
-
gh-125115: Fixed a bug in pdb where arguments starting with
-can’t be passed to the debugged script. -
gh-53203: Fix time.strptime() for
%c,%xand%Xformats in many locales that use non-ASCII digits, like Persian, Burmese, Odia and Shan. -
gh-125243: Fix data race when creating zoneinfo.ZoneInfo objects in the free threading build.
-
gh-125254: Fix a bug where ArgumentError includes the incorrect ambiguous option in argparse.
-
gh-125235: Keep tkinter TCL paths in venv pointing to base installation on Windows.
-
gh-61011: Fix inheritance of nested mutually exclusive groups from parent parser in argparse.ArgumentParser. Previously, all nested mutually exclusive groups lost their connection to the group containing them and were displayed as belonging directly to the parser.
-
gh-125118: Don’t copy arbitrary values to _Bool in the struct module.
-
gh-125069: Fix an issue where providing a pathlib.PurePath object as an initializer argument to a second PurePath object with a different parser resulted in arguments to the former object’s initializer being joined by the latter object’s parser.
-
gh-125096: If the PYTHON_BASIC_REPL environment variable is set, the site module no longer imports the
_pyreplmodule. Moreover, the site module now respects -E and -I command line options: ignore PYTHON_BASIC_REPL in this case. Patch by Victor Stinner. -
gh-124969: Fix
locale.nl_langinfo(locale.ALT_DIGITS). Now it returns a tuple of up to 100 strings (an empty tuple on most locales). Previously it returned the first item of that tuple or an empty string. -
gh-124960: Fix support for the
barry_as_FLUFLfuture flag in the new REPL. -
gh-124958: Fix refcycles in exceptions raised from asyncio.TaskGroup and the python implementation of asyncio.Future
-
gh-53203: Fix time.strptime() for
%cand%xformats in many locales: Arabic, Bislama, Breton, Bodo, Kashubian, Chuvash, Estonian, French, Irish, Ge’ez, Gurajati, Manx Gaelic, Hebrew, Hindi, Chhattisgarhi, Haitian Kreyol, Japanese, Kannada, Korean, Marathi, Malay, Norwegian, Nynorsk, Punjabi, Rajasthani, Tok Pisin, Yoruba, Yue Chinese, Yau/Nungon and Chinese. -
gh-124917: Allow calling os.path.exists() and os.path.lexists() with keyword arguments on Windows. Fixes a regression in 3.13.0.
-
gh-124653: Fix detection of the minimal Queue API needed by the logging module. Patch by Bénédikt Tran.
-
gh-124390: Fixed AssertionError when using
asyncio.staggered.staggered_race()with asyncio.eager_task_factory. -
gh-116850: Fix argparse for namespaces with not directly writable dict (e.g. classes).
-
gh-58573: Fix conflicts between abbreviated long options in the parent parser and subparsers in argparse.
-
gh-124594: All asyncio REPL prompts run in the same context. Contributed by Bartosz Sławecki.
-
gh-61181: Fix support of choices with string value in argparse. Substrings of the specified string no longer considered valid values.
-
gh-80259: Fix argparse support of positional arguments with
nargs='?',default=argparse.SUPPRESSand specifiedtype. -
gh-120378: Fix a crash related to an integer overflow in curses.resizeterm() and curses.resize_term().
-
gh-123884: Fixed bug in itertools.tee() handling of other tee inputs (a tee in a tee). The output now has the promised n independent new iterators. Formerly, the first iterator was identical (not independent) to the input iterator. This would sometimes give surprising results.
-
gh-58956: Fixed a bug in pdb where sometimes the breakpoint won’t trigger if it was set on a function which is already in the call stack.
-
gh-124345: argparse vim supports abbreviated single-dash long options separated by
=from its value. -
gh-104860: Fix disallowing abbreviation of single-dash long options in argparse with
allow_abbrev=False. -
gh-63143: Fix parsing mutually exclusive arguments in argparse. Arguments with the value identical to the default value (e.g. booleans, small integers, empty or 1-character strings) are no longer considered “not present”.
-
gh-72795: Positional arguments with nargs equal to
'*'orargparse.REMAINDERare no longer required. This allows to use positional argument withnargs='*'and withoutdefaultin mutually exclusive group and improves error message about required arguments. -
gh-59317: Fix parsing positional argument with nargs equal to
'?'or'*'if it is preceded by an option and another positional argument. -
gh-53780: argparse now ignores the first
"--"(double dash) between an option and command. -
gh-124217: Add RFC 9637 reserved IPv6 block
3fff::/20in ipaddress module. -
gh-81691: Fix handling of multiple
"--"(double dashes) in argparse. Only the first one has now been removed, all subsequent ones are now taken literally. -
gh-122765: Fix unbalanced quote errors occurring when activate.csh in venv was sourced with a custom prompt containing unpaired quotes or newlines.
-
gh-116810: Resolve a memory leak introduced in CPython 3.10’s ssl when the ssl.SSLSocket.session property was accessed. Speeds up read and write access to said property by no longer unnecessarily cloning session objects via serialization.
-
bpo-14074: Fix argparse metavar processing to allow positional arguments to have a tuple metavar.
IDLE
- gh-122392: Increase currently inadequate vertical spacing for the IDLE browsers (path, module, and stack) on high-resolution monitors.
Documentation
-
gh-125018: The importlib.metadata documentation now includes semantic cross-reference targets for the significant documented APIs. This means intersphinx references like importlib.metadata.version() will now work as expected.
-
gh-70870: Clarified the dual usage of the term “free variable” (both the formal meaning of any reference to names defined outside the local scope, and the narrower pragmatic meaning of nonlocal variables named in
co_freevars). -
bpo-34008: The Py_Main() documentation moved from the “Very High Level API” section to the “Initialization and Finalization” section.
Also make it explicit that we expect Py_Main to typically be called instead of Py_Initialize rather than after it (since Py_Main makes its own call to Py_Initialize). Document that calling both is supported but is version dependent on which settings will be applied correctly.
Core and Builtins
-
gh-125444: Fix illegal instruction for older Arm architectures. Patch by Diego Russo, testing by Ross Burton.
-
gh-124375: Fix a crash in the free threading build when the GC runs concurrently with a new thread starting.
-
gh-125221: Fix possible race condition when calling reduce_ex() for the first time in the free threading build.
-
gh-123378: Fix a crash in the str() method of UnicodeError objects when the UnicodeError.start and UnicodeError.end values are invalid or out-of-range. Patch by Bénédikt Tran.
-
gh-122878: Use the
pagerbinary, if available (e.g. on Debian and derivatives), to display REPLhelp(). -
gh-124188: Fix reading and decoding a line from the source file witn non-UTF-8 encoding for syntax errors raised in the compiler.
C API
- bpo-34008: Added
Py_IsInitializedto the list of APIs that are safe to call before the interpreter is initialized, and updated the embedding tests to cover it.
Build
-
gh-125269: Fix detection of whether
-latomicis needed when cross-compiling CPython using the configure script. -
gh-121634: Allow for specifying the target compile triple for WASI.
-
gh-122578: Use WASI SDK 24 for testing.
Python 3.13.0 final
Release date: 2024-10-07
Core and Builtins
-
gh-125008: Fix tokenize.untokenize() producing invalid syntax for double braces preceded by certain escape characters.
-
gh-124871: Fix compiler bug (in some versions of 3.13) where an assertion fails during reachability analysis.
Python 3.13.0 release candidate 3
Release date: 2024-10-01
macOS
- gh-123797: Check for runtime availability of
ptsname_rfunction on macos.
Windows
-
gh-124609: Fix
_Py_ThreadIdfor Windows builds using MinGW. Patch by Tony Roberts. -
gh-124254: Ensures experimental free-threaded binaries remain installed when updating.
-
gh-123915: Ensure that
Tools\msi\buildrelease.batuses different directories for AMD64 and ARM64 builds.
Tests
- gh-124378: Updated
test_ttkto pass with Tcl/Tk 8.6.15.
Library
-
gh-124538: Fixed crash when using gc.get_referents() on a capsule object.
-
gh-124498: Fix typing.TypeAliasType not to be generic, when
type_paramsis an empty tuple. -
gh-123017: Due to unreliable results on some devices, time.strftime() no longer accepts negative years on Android.
-
gh-123014: os.pidfd_open() and signal.pidfd_send_signal() are now unavailable when building against Android API levels older than 31, since the underlying system calls may cause a crash.
-
gh-124248: Fixed potential crash when using struct to process zero-width ‘Pascal string’ fields (
0p). -
gh-87041: Fix a bug in argparse where lengthy subparser argument help is incorrectly indented.
-
gh-124212: Fix invalid variable in venv handling of failed symlink on Windows
-
gh-124171: Add workaround for broken
fmod()implementations on Windows, that loose zero sign (e.g.fmod(-10, 1)returns0.0). Patch by Sergey B Kirpichev. -
gh-123934: Fix unittest.mock.MagicMock reseting magic methods return values after
.reset_mock(return_value=True)was called. -
gh-123968: Fix the command-line interface for the random module to select floats between 0 and N, not 1 and N.
-
gh-123892: Add
"_wmi"to sys.stdlib_module_names. Patch by Victor Stinner. -
gh-123339: Fix inspect.getsource() for classes in collections.abc and decimal (for pure Python implementation) modules. inspect.getcomments() now raises OSError instead of IndexError if the
__firstlineno__value for a class is out of bound. -
gh-121735: When working with zip archives, importlib.resources now properly honors module-adjacent references (e.g.
files(pkg.mod)and not justfiles(pkg)). -
gh-122145: Fix an issue when reporting tracebacks corresponding to Python code emitting an empty AST body. Patch by Nikita Sobolev and Bénédikt Tran.
-
gh-119004: Fix a crash in OrderedDict.eq when operands are mutated during the check. Patch by Bénédikt Tran.
-
bpo-44864: Do not translate user-provided strings in argparse.ArgumentParser.
IDLE
-
gh-112938: Fix uninteruptable hang when Shell gets rapid continuous output.
-
gh-120104: Fix padding in config and search dialog windows in IDLE.
Documentation
-
gh-124720: Update “Using Python on a Mac” section of the “Python Setup and Usage” document and include information on installing free-threading support.
-
gh-116622: Add an Android platform guide, and flag modules not available on Android.
Core and Builtins
-
gh-124567: Revert the incremental GC (in 3.13), since it’s not clear the benefits outweigh the costs at this point.
-
gh-124642: Fixed scalability issue in free-threaded builds for lock-free reads from dictionaries in multi-threaded scenarios
-
gh-116510: Fix a bug that can cause a crash when sub-interpreters use “basic” single-phase extension modules. Shared objects could refer to PyGC_Head nodes that had been freed as part of interpreter cleanup.
-
gh-124547: When deallocating an object with inline values whose
__dict__is still live: if memory allocation for the inline values fails, clear the dictionary. Prevents an interpreter crash. -
gh-124513: Fix a crash in FrameLocalsProxy constructor: check the number of arguments. Patch by Victor Stinner.
-
gh-124442: Fix nondeterminism in compilation by sorting the value of static_attributes. Patch by kp2pml30.
-
gh-123856: Fix PyREPL failure when a keyboard interrupt is triggered after using a history search
-
gh-65961: Document the deprecation of setting and using
__package__and__cached__. -
gh-124027: Support
<page up>,<page down>, and<delete>keys in the Python REPL when$TERMis set tovt100. -
gh-77894: Fix possible crash in the garbage collector when it tries to break a reference loop containing a memoryview object. Now a
memoryviewobject can only be cleared if there are no buffers that refer it. -
gh-123339: Setting the
__module__attribute for a class now removes the__firstlineno__item from the type’s dict, so they will no longer be inconsistent.
C API
-
gh-124160: Fix crash when importing modules containing state and single-phase initialization in a subinterpreter.
-
gh-123880: Fixed a bug that prevented circular imports of extension modules that use single-phase initialization.
Build
-
gh-124487: Windows builds now use Windows 8.1 as their API baseline (installation already required Windows 8.1).
-
gh-124043: Building using --with-trace-refs is (temporarily) disallowed when the GIL is disabled.
Python 3.13.0 release candidate 2
Release date: 2024-09-06
macOS
- gh-123418: Updated macOS installer build to use OpenSSL 3.0.15.
Windows
-
gh-123418: Updated Windows build to use OpenSSL 3.0.15.
-
gh-122573: The Windows build of CPython now requires 3.10 or newer.
-
gh-100256: mimetypes no longer fails when it encounters an inaccessible registry key.
-
gh-79846: Makes
ssl.create_default_context()ignore invalid certificates in the Windows certificate store
Tools/Demos
- gh-123418: Update GitHub CI workflows to use OpenSSL 3.0.15 and multissltests to use 3.0.15, 3.1.7, and 3.2.3.
Tests
-
gh-119727: Add
--single-processcommand line option to Python test runner (regrtest). Patch by Victor Stinner. -
gh-101525: Skip
test_gdbif the binary is relocated by BOLT. Patch by Donghee Na.
Security
-
gh-123678: Upgrade libexpat to 2.6.3
-
gh-121285: Remove backtracking from tarfile header parsing for
hdrcharset, PAX, and GNU sparse headers.
Library
-
gh-123657: Fix crash and memory leak in decimal.getcontext(). It crashed when using a thread-local context by
--with-decimal-contextvar=no. -
gh-123448: Fixed memory leak of typing.NoDefault by moving it to the static types array.
-
gh-123409: Fix ipaddress.IPv6Address.reverse_pointer output according to RFC 3596, §2.5. Patch by Bénédikt Tran.
-
gh-123270: Applied a more surgical fix for malformed payloads in zipfile.Path causing infinite loops (gh-122905) without breaking contents using legitimate characters.
-
gh-123228: Fix return type for
_pyrepl.readline._ReadlineWrapper.get_line_buffer()to be str(). Patch by Sergey B Kirpichev. -
gh-123240: Raise audit events for the input() in the new REPL.
-
gh-123243: Fix memory leak in
_decimal. -
gh-122546: Consistently use same file name for different exceptions in the new repl. Patch by Sergey B Kirpichev.
-
gh-123213: xml.etree.ElementTree.Element.extend() and Element assignment no longer hide the internal exception if an erronous generator is passed. Patch by Bar Harel.
-
gh-85110: Preserve relative path in URL without netloc in urllib.parse.urlunsplit() and urllib.parse.urlunparse().
-
gh-123067: Fix quadratic complexity in parsing
"-quoted cookie values with backslashes by http.cookies. -
gh-122981: Fix inspect.getsource() for generated classes with Python base classes (e.g. enums).
-
gh-122903:
zipfile.Path.globnow correctly matches directories instead of silently omitting them. -
gh-122905: zipfile.Path objects now sanitize names from the zipfile.
-
gh-122695: Fixed double-free when using gc.get_referents() with a freed asyncio.Future iterator.
-
gh-116263: logging.handlers.RotatingFileHandler no longer rolls over empty log files.
-
gh-105376: Restore the deprecated logging
warn()method. It was removed in Python 3.13 alpha 1. Keep the deprecatedwarn()method in Python 3.13. Patch by Victor Stinner. -
gh-122744: Bump the version of pip bundled in ensurepip to version 24.2.
-
gh-118814: Fix the typing.TypeVar constructor when name is passed by keyword.
-
gh-122478: Remove internal frames from tracebacks shown in code.InteractiveInterpreter with non-default sys.excepthook(). Save correct tracebacks in sys.last_traceback and update
__traceback__attribute of sys.last_value and sys.last_exc. -
gh-116622: On Android, the
FICLONEandFICLONERANGEconstants are no longer exposed by fcntl, as these ioctls are blocked by SELinux. -
gh-82378: Make sure that the new REPL interprets sys.tracebacklimit in the same way that the classic REPL did.
-
gh-122334: Fix crash when importing ssl after the main interpreter restarts.
-
gh-87320: In code.InteractiveInterpreter, handle exceptions caused by calling a non-default sys.excepthook(). Before, the exception bubbled up to the caller, ending the REPL.
-
gh-121650: email headers with embedded newlines are now quoted on output. The generator will now refuse to serialize (write) headers that are unsafely folded or delimited; see verify_generated_headers. (Contributed by Bas Bloemsaat and Petr Viktorin in gh-121650.)
-
gh-121723: Make logging.config.dictConfig() accept any object implementing the Queue public API. See the queue configuration section for details. Patch by Bénédikt Tran.
-
gh-122081: Fix a crash in the
decimal.IEEEContext()optional function available via theEXTRA_FUNCTIONALITYconfiguration flag. -
gh-121804: Correctly show error locations, when SyntaxError raised in new repl. Patch by Sergey B Kirpichev.
-
gh-121151: Fix wrapping of long usage text of arguments inside a mutually exclusive group in argparse.
-
gh-108172:
webbrowserhonors OS preferred browser on Linux when its desktop entry name contains the text of a known browser name. -
gh-109109: You can now get the raw TLS certificate chains from TLS connections via ssl.SSLSocket.get_verified_chain() and ssl.SSLSocket.get_unverified_chain() methods.
Contributed by Mateusz Nowak.
IDLE
- gh-120083: Add explicit black IDLE Hovertip foreground color needed for recent macOS. Fixes Sonoma showing unreadable white on pale yellow. Patch by John Riggles.
Core and Builtins
-
gh-120221: asyncio REPL is now again properly recognizing KeyboardInterrupts. Display of exceptions raised in secondary threads is fixed.
-
gh-119310: Allow the new interactive shell to read history files written with the editline library that use unicode-escaped entries. Patch by aorcajo and Łukasz Langa.
-
gh-123572: Fix key mappings for various F-keys in Windows for the new REPL. Patch by devdanzin
-
gh-119034: Change
<page up>and<page down>keys of the Python REPL to history search forward/backward. Patch by Victor Stinner. -
gh-123545: Fix a double decref in rare cases on experimental JIT builds.
-
gh-123484: Fix
_Py_DebugOffsetsfor long objects to be relative to the start of the object rather than the start of a subobject. -
gh-123344: Add AST optimizations for type parameter defaults.
-
gh-123321: Prevent Parser/myreadline race condition from segfaulting on multi-threaded use. Patch by Bar Harel and Amit Wienner.
-
gh-123177: Fix a bug causing stray prompts to appear in the middle of wrapped lines in the new REPL.
-
gh-122982: Extend the deprecation period for bool inversion (
~) by two years. -
gh-123275: Support -X gil=1 and PYTHON_GIL=1 on non-free-threaded builds.
-
gh-123177: Deactivate line wrap in the Apple Terminal via a ANSI escape code. Patch by Pablo Galindo
-
gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer. Patch by Pablo Galindo
-
gh-122298: Restore printout of GC stats when
gc.set_debug(gc.DEBUG_STATS)is called. This featue was accidentally removed when implementing incremental GC. -
gh-121804: Correctly show error locations when a SyntaxError is raised in the basic REPL. Patch by Sergey B Kirpichev.
-
gh-123142: Fix too-wide source location in exception tracebacks coming from broken iterables in comprehensions.
-
gh-123048: Fix a bug where pattern matching code could emit a JUMP_FORWARD with no source location.
-
gh-123123: Fix displaying SyntaxError exceptions covering multiple lines. Patch by Pablo Galindo
-
gh-123083: Fix a potential use-after-free in
STORE_ATTR_WITH_HINT. -
gh-123022: Fix crash in free-threaded build when calling Py_Initialize() from a non-main thread.
-
gh-122888: Fix crash on certain calls to
str()with positional arguments of the wrong type. Patch by Jelle Zijlstra. -
gh-116622: Fix Android stdout and stderr messages being truncated or lost.
-
gh-122527: Fix a crash that occurred when a
PyStructSequencewas deallocated after its type’s dictionary was cleared by the GC. The type’s tp_basicsize now accounts for non-sequence fields that aren’t included in the Py_SIZE of the sequence. -
gh-122445: Add only fields which are modified via self.* to static_attributes.
-
gh-98442: Fix too wide source locations of the cleanup instructions of a with statement.
-
gh-93691: Fix source locations of instructions generated for with statements.
-
gh-120097:
FrameLocalsProxynow subclassescollections.abc.Mappingand can be matched as a mapping inmatchstatements
C API
- gh-122728: Fix PyEval_GetLocals() to avoid SystemError (“bad argument to internal function”). Patch by Victor Stinner.
(本文超出站点单文档体积上限,已按小节截断)
