库
gh-122400 [https://github.com/python/cpython/issues/122400]: Handle
ValueError
s raised byos.stat()
infilecmp.dircmp
andfilecmp.cmpfiles()
. Patch by Bénédikt Tran.gh-122311 [https://github.com/python/cpython/issues/122311]: Fix some error messages in
pickle
.gh-122332 [https://github.com/python/cpython/issues/122332]: Fixed segfault with
asyncio.Task.get_coro()
when using an eager task factory.gh-105733 [https://github.com/python/cpython/issues/105733]:
ctypes.ARRAY()
is now soft deprecated: it no longer emits deprecation warnings and is not scheduled for removal.gh-122087 [https://github.com/python/cpython/issues/122087]: Restore
inspect.ismethoddescriptor()
andinspect.isroutine()
returningFalse
forfunctools.partial
objects.gh-122170 [https://github.com/python/cpython/issues/122170]: Handle
ValueError
s raised byos.stat()
inlinecache
. Patch by Bénédikt Tran.gh-82951 [https://github.com/python/cpython/issues/82951]: Serializing objects with complex
__qualname__
(such as unbound methods and nested classes) by name no longer involves serializing parent objects by value in pickle protocols < 4.gh-113785 [https://github.com/python/cpython/issues/113785]:
csv
now correctly parses numeric fields (when used withcsv.QUOTE_NONNUMERIC
orcsv.QUOTE_STRINGS
) which start with an escape character.gh-122088 [https://github.com/python/cpython/issues/122088]:
@warnings.deprecated
now copies the coroutine status of functions and methods so thatinspect.iscoroutinefunction()
returns the correct result.gh-120930 [https://github.com/python/cpython/issues/120930]: Fixed a bug introduced by gh-92081 [https://github.com/python/cpython/issues/92081] that added an incorrect extra blank to encoded words occurring in wrapped headers.
gh-121474 [https://github.com/python/cpython/issues/121474]: Fix missing sanity check for
parties
arg inthreading.Barrier
constructor. Patch by Clinton Christian (pygeek).gh-120289 [https://github.com/python/cpython/issues/120289]: Fixed the use-after-free issue in
cProfile
by disallowingdisable()
andclear()
in external timers.
IDLE
- gh-122482 [https://github.com/python/cpython/issues/122482]: Change About IDLE to direct users to discuss.python.org instead of the now unused idle-dev email and mailing list.
核心与内置函数
gh-116090 [https://github.com/python/cpython/issues/116090]: Fix an issue in JIT builds that prevented some
for
loops from correctly firingRAISE
monitoring events.gh-122208 [https://github.com/python/cpython/issues/122208]: Dictionary watchers now only deliver the PyDict_EVENT_ADDED event when the insertion is in a known good state to succeed.
gh-122300 [https://github.com/python/cpython/issues/122300]: Preserve AST nodes for fstring with single-element format specifiers. Patch by Pablo Galindo
gh-120906 [https://github.com/python/cpython/issues/120906]:
frame.f_locals
now supports arbitrary hashable objects as keys.gh-122029 [https://github.com/python/cpython/issues/122029]: Emit
c_call
events insys.setprofile()
when aPyMethodObject
pointing to aPyCFunction
is called.gh-122026 [https://github.com/python/cpython/issues/122026]: Fix a bug that caused the tokenizer to not correctly identify mismatched parentheses inside fstrings in some situations. Patch by Pablo Galindo
gh-118934 [https://github.com/python/cpython/issues/118934]: Make
PyEval_GetLocals
return borrowed reference
C API
gh-116622 [https://github.com/python/cpython/issues/116622]: Make
PyObject_Print
work around a bug in Android and OpenBSD which prevented it from throwing an exception when trying to write to a readonly stream.gh-121489 [https://github.com/python/cpython/issues/121489]: Export private
PyBytesJoin()
again.
构建
- gh-120522 [https://github.com/python/cpython/issues/120522]: Added a
--with-app-store-compliance
option to patch out known issues with macOS/iOS App Store review processes.
Python 3.13.0 beta 4
Release date: 2024-07-18
测试
gh-121084 [https://github.com/python/cpython/issues/121084]: Fix test_typing random leaks. Clear typing ABC caches when running tests for refleaks (
-R
option): callabccaches_clear()
on typing abstract classes and their subclasses. Patch by Victor Stinner.gh-121160 [https://github.com/python/cpython/issues/121160]: Add a test for
readline.set_history_length()
. Note that this test may fail on readline libraries.gh-121200 [https://github.com/python/cpython/issues/121200]: Fix
test_expanduser_pwd2()
oftest_posixpath
. Callgetpwnam()
to getpw_dir
, since it can be different thangetpwall()
pw_dir
. Patch by Victor Stinner.gh-121188 [https://github.com/python/cpython/issues/121188]: When creating the JUnit XML file, regrtest now escapes characters which are invalid in XML, such as the chr(27) control character used in ANSI escape sequences. Patch by Victor Stinner.
库
gh-57141 [https://github.com/python/cpython/issues/57141]: The shallow argument to
filecmp.dircmp
(new in Python 3.13) is now keyword-only.gh-121245 [https://github.com/python/cpython/issues/121245]: Simplify handling of the history file in
site.register_readline()
helper. TheCAN_USE_PYREPL
variable now will be initialized, when imported. Patch by Sergey B Kirpichev.gh-121332 [https://github.com/python/cpython/issues/121332]: Fix constructor of
ast
nodes with custom_attributes
. Previously, passing custom attributes would raise aDeprecationWarning
. Passing arguments to the constructor that are not in_fields
or_attributes
remains deprecated. Patch by Jelle Zijlstra.gh-121279 [https://github.com/python/cpython/issues/121279]: Avoid
NameError
for thewarnings
module when accessing the depracated atributes of theimportlib.abc
module.gh-121245 [https://github.com/python/cpython/issues/121245]: Fix a bug in the handling of the command history of the new REPL that caused the history file to be wiped at REPL exit.
gh-87744 [https://github.com/python/cpython/issues/87744]: Fix waitpid race while calling
send_signal()
in asyncio. Patch by Kumar Aditya.gh-121018 [https://github.com/python/cpython/issues/121018]: Fixed other issues where
argparse.ArgumentParser
did not honorexit_on_error=False
.gh-120678 [https://github.com/python/cpython/issues/120678]: Fix regression in the new REPL that meant that globals from files passed using the
-i
argument would not be included in the REPL's global namespace. Patch by Alex Waygood.gh-120782 [https://github.com/python/cpython/issues/120782]: Fix wrong references of the
datetime
types after reloading the module.gh-120713 [https://github.com/python/cpython/issues/120713]:
datetime.datetime.strftime()
now 0-pads years with less than four digits for the format specifiers%Y
and%G
on Linux. Patch by Ben Hsinggh-117983 [https://github.com/python/cpython/issues/117983]: Defer the
threading
import inimportlib.util
until lazy loading is used.gh-119189 [https://github.com/python/cpython/issues/119189]: When using the
**
operator orpow()
withFraction
as the base and an exponent that is not rational, a float, or a complex, the fraction is no longer converted to a float.gh-118714 [https://github.com/python/cpython/issues/118714]: Allow
restart
in post-mortem debugging ofpdb
. Removed restart message when the user quits pdb from post-mortem mode.gh-105623 [https://github.com/python/cpython/issues/105623]: Fix performance degradation in
logging.handlers.RotatingFileHandler
. Patch by Craig Robson.
IDLE
- gh-78889 [https://github.com/python/cpython/issues/78889]: Stop Shell freezes by blocking user access to non-method sys.stdout.shell attributes, which are all private.
文档
gh-121749 [https://github.com/python/cpython/issues/121749]: Fix documentation for
PyModule_AddObjectRef()
.gh-120012 [https://github.com/python/cpython/issues/120012]: Clarify the behaviours of
multiprocessing.Queue.empty()
andmultiprocessing.SimpleQueue.empty()
on closed queues. Patch by Bénédikt Tran.
核心与内置函数
gh-121860 [https://github.com/python/cpython/issues/121860]: Fix crash when rematerializing a managed dictionary after it was deleted.
gh-121814 [https://github.com/python/cpython/issues/121814]: Fixed the SegFault when
PyEval_SetTrace()
is used with no Python frame on stack.gh-121295 [https://github.com/python/cpython/issues/121295]: Fix PyREPL console getting into a blocked state after interrupting a long paste
gh-121794 [https://github.com/python/cpython/issues/121794]: Fix bug in free-threaded Python where a resurrected object could lead to a negative ref count assertion failure.
gh-121657 [https://github.com/python/cpython/issues/121657]: Improve the
SyntaxError
message if the user tries to useyield from
outside a function.gh-121609 [https://github.com/python/cpython/issues/121609]: Fix pasting of characters containing unicode character joiners in the new REPL. Patch by Marta Gomez Macias
gh-117482 [https://github.com/python/cpython/issues/117482]: Unexpected slot wrappers are no longer created for builtin static types in subinterpreters.
gh-121499 [https://github.com/python/cpython/issues/121499]: Fix a bug affecting how multiline history was being rendered in the new REPL after interacting with the new screen cache. Patch by Pablo Galindo
gh-121497 [https://github.com/python/cpython/issues/121497]: Fix a bug that was preventing the REPL to correctly respect the history when an input hook was set. Patch by Pablo Galindo
gh-121012 [https://github.com/python/cpython/issues/121012]: Tier 2 execution now ensures that list iterators remain exhausted, once they become exhausted.
gh-121439 [https://github.com/python/cpython/issues/121439]: Allow tuples of length 20 in the freelist to be reused.
gh-121368 [https://github.com/python/cpython/issues/121368]: Fix race condition in
PyTypeLookup
in the free-threaded build due to a missing memory fence. This could lead toPyTypeLookup
returning incorrect results on arm64.gh-121130 [https://github.com/python/cpython/issues/121130]: Fix fstrings with debug expressions in format specifiers. Patch by Pablo Galindo
gh-121115 [https://github.com/python/cpython/issues/121115]:
PyLong_AsNativeBytes()
no longer uses__index__()
methods by default. ThePy_ASNATIVEBYTES_ALLOW_INDEX
flag has been added to allow it.
C API
gh-89364 [https://github.com/python/cpython/issues/89364]: Export the
PySignal_SetWakeupFd()
function. Previously, the function was documented but it couldn't be used in 3rd party code. Patch by Victor Stinner.gh-113993 [https://github.com/python/cpython/issues/113993]:
PyUnicode_InternInPlace()
no longer prevents its argument from being garbage collected.
Several functions that take char *
are now documented as possibly preventing string objects from being garbage collected; refer to their documentation for details: PyUnicode_InternFromString()
, PyDict_SetItemString()
, PyObject_SetAttrString()
, PyObject_DelAttrString()
, PyUnicode_InternFromString()
, and PyModule_Add*
convenience functions.
gh-113601 [https://github.com/python/cpython/issues/113601]: Removed debug build assertions related to interning strings, which were falsely triggered by stable ABI extensions.
gh-112136 [https://github.com/python/cpython/issues/112136]: Restore the private
PyArgParser
structure and the privatePyArgParseTupleAndKeywordsFast()
function, previously removed in Python 3.13 alpha 1. Patch by Victor Stinner.
构建
gh-120371 [https://github.com/python/cpython/issues/120371]: Support WASI SDK 22 by explicitly skipping functions that are just stubs in wasi-libc.
gh-121731 [https://github.com/python/cpython/issues/121731]: Fix mimalloc compile error on GNU/Hurd
gh-121487 [https://github.com/python/cpython/issues/121487]: Fix deprecation warning for ATOMIC_VAR_INIT in mimalloc.
gh-121467 [https://github.com/python/cpython/issues/121467]: Fix a Makefile bug that prevented mimalloc header files from being installed.
gh-121103 [https://github.com/python/cpython/issues/121103]: On POSIX systems, excluding macOS framework installs, the lib directory for the free-threaded build now includes a "t" suffix to avoid conflicts with a co-located default build installation.
gh-120831 [https://github.com/python/cpython/issues/120831]: The default minimum iOS version was increased to 13.0.
gh-113565 [https://github.com/python/cpython/issues/113565]: Improve
curses
andcurses.panel
dependency checks in configure.
Python 3.13.0 beta 3
Release date: 2024-06-27
核心与内置函数
gh-120838 [https://github.com/python/cpython/issues/120838]:
Py_Finalize()
andPy_FinalizeEx()
now always run with the main interpreter active.gh-113433 [https://github.com/python/cpython/issues/113433]: Subinterpreters now get cleaned up automatically during runtime finalization.
gh-119462 [https://github.com/python/cpython/issues/119462]: Make sure that invariants of type versioning are maintained: Superclasses always have their version number assigned before subclasses The version tag is always zero if the tag is not valid. * The version tag is always non-zero if the tag is valid.
gh-120437 [https://github.com/python/cpython/issues/120437]: Fix
CHECKSTACK_SPACE
optimization problems introduced in gh-118322 [https://github.com/python/cpython/issues/118322].gh-120722 [https://github.com/python/cpython/issues/120722]: Correctly set the bytecode position on return instructions within lambdas. Patch by Jelle Zijlstra.
gh-120367 [https://github.com/python/cpython/issues/120367]: Fix bug where compiler creates a redundant jump during pseudo-op replacement. Can only happen with a synthetic AST that has a try on the same line as the instruction following the exception handler.
gh-113993 [https://github.com/python/cpython/issues/113993]: Strings interned with
sys.intern()
are again garbage-collected when no longer used, as per the documentation. Strings interned with the C functionPyUnicode_InternInPlace()
are still immortal. Internals of the string interning mechanism have been changed. This may affect performance and identities ofstr
objects.gh-120384 [https://github.com/python/cpython/issues/120384]: Fix an array out of bounds crash in
list_ass_subscript
, which could be invoked via some specificly tailored input: including concurrent modification of a list object, where one thread assigns a slice and another clears it.gh-120367 [https://github.com/python/cpython/issues/120367]: Fix crash in compiler on code with redundant NOPs and JUMPs which show up after exception handlers are moved to the end of the code.
gh-120380 [https://github.com/python/cpython/issues/120380]: Fix Python implementation of
pickle.Pickler
forbytes
andbytearray
objects when using protocol version 5. Patch by Bénédikt Tran.gh-120400 [https://github.com/python/cpython/issues/120400]: Support Linux perf profiler to see Python calls on RISC-V architecture.
gh-120221 [https://github.com/python/cpython/issues/120221]: Deliver real signals on Ctrl-C and Ctrl-Z in the new REPL. Patch by Pablo Galindo
gh-120346 [https://github.com/python/cpython/issues/120346]: Respect
PYTHON_BASIC_REPL
when running in interative inspect mode (python -i
). Patch by Pablo Galindogh-93691 [https://github.com/python/cpython/issues/93691]: Fix source locations of instructions generated for the iterator of a for statement.
gh-120198 [https://github.com/python/cpython/issues/120198]: Fix a crash when multiple threads read and write to the same
__class__
of an object concurrently.gh-120298 [https://github.com/python/cpython/issues/120298]: Fix use-after free in
list_richcompare_impl
which can be invoked via some specificly tailored evil input.gh-119666 [https://github.com/python/cpython/issues/119666]: Fix a compiler crash in the case where two comprehensions in class scope both reference
__class__
.gh-120225 [https://github.com/python/cpython/issues/120225]: Fix crash in compiler on empty block at end of exception handler.
gh-119933 [https://github.com/python/cpython/issues/119933]: Improve
SyntaxError
messages for invalid expressions in a type parameters bound, a type parameter constraint tuple or a default type parameter. Patch by Bénédikt Tran.bpo-24766 [https://bugs.python.org/issue?@action=redirect&bpo=24766]: Fix handling of
doc
argument to subclasses ofproperty
.
库
gh-121027 [https://github.com/python/cpython/issues/121027]: Add a future warning in
functools.partial._get_()
. In future Python versionsfunctools.partial
will be a method descriptor.gh-121025 [https://github.com/python/cpython/issues/121025]: Improve the
_repr_()
offunctools.partialmethod
. Patch by Bénédikt Tran.gh-121018 [https://github.com/python/cpython/issues/121018]: Fixed an issue where
argparse.ArgumentParser.parses_args()
did not honorexit_on_error=False
when given unrecognized arguments. Patch by Ben Hsing.gh-119614 [https://github.com/python/cpython/issues/119614]: Fix truncation of strings with embedded null characters in some internal operations in
tkinter
.gh-120910 [https://github.com/python/cpython/issues/120910]: When reading installed files from an egg, use
relative_to(walk_up=True)
to honor files installed outside of the installation root.gh-120888 [https://github.com/python/cpython/issues/120888]: Upgrade pip wheel bundled with ensurepip (pip 24.1.1)
gh-101830 [https://github.com/python/cpython/issues/101830]: Accessing the
tkinter
object's string representation no longer converts the underlying Tcl object to a string on Windows.gh-120811 [https://github.com/python/cpython/issues/120811]: Fix possible memory leak in
contextvars.Context.run()
.gh-120769 [https://github.com/python/cpython/issues/120769]: Make empty line in
pdb
repeats the last command even when the command is fromcmdqueue
.gh-120732 [https://github.com/python/cpython/issues/120732]: Fix
name
passing tounittest.mock.Mock
object when usingunittest.mock.create_autospec()
.gh-120683 [https://github.com/python/cpython/issues/120683]: Fix an error in
logging.LogRecord
, when the integer part of the timestamp is rounded up, while the millisecond calculation truncates, causing the log timestamp to be wrong by up to 999 ms (affected roughly 1 in 8 million timestamps).gh-120633 [https://github.com/python/cpython/issues/120633]: Move scrollbar and remove tearoff menus in turtledemo.
gh-120541 [https://github.com/python/cpython/issues/120541]: Improve the prompt in the "less" pager when
help()
is called with non-string argument.gh-120495 [https://github.com/python/cpython/issues/120495]: Fix incorrect exception handling in Tab Nanny. Patch by Wulian233.
gh-120381 [https://github.com/python/cpython/issues/120381]: Correct
inspect.ismethoddescriptor()
to check also for the lack of__delete__()
. Patch by Jan Kaliszewski.gh-90425 [https://github.com/python/cpython/issues/90425]: The OS byte in gzip headers is now always set to 255 when using
gzip.compress()
.gh-120343 [https://github.com/python/cpython/issues/120343]: Fix column offset reporting for tokens that come after multiline fstrings in the
tokenize
module.gh-119600 [https://github.com/python/cpython/issues/119600]: Fix
unittest.mock.patch()
to not read attributes of the target whennew_callable
is set. Patch by Robert Collins.gh-114053 [https://github.com/python/cpython/issues/114053]: Fix edge-case bug where
typing.get_type_hints()
would produce incorrect results if type parameters in a class scope were overridden by assignments in a class scope andfrom __future__ import annotations
semantics were enabled. Patch by Alex Waygood.gh-114053 [https://github.com/python/cpython/issues/114053]: Fix erroneous
NameError
when callinginspect.get_annotations()
witheval_str=True`
on a class that made use of PEP 695 [https://peps.python.org/pep-0695/] type parameters in a module that hadfrom __future__ import annotations
at the top of the file. Patch by Alex Waygood.gh-120268 [https://github.com/python/cpython/issues/120268]: Prohibit passing
None
to pure-Pythondatetime.date.fromtimestamp()
to achieve consistency with C-extension implementation.gh-120244 [https://github.com/python/cpython/issues/120244]: Fix memory leak in
re.sub()
when the replacement string contains backreferences.gh-120211 [https://github.com/python/cpython/issues/120211]: Fix
tkinter.ttk
with Tcl/Tk 9.0.gh-71587 [https://github.com/python/cpython/issues/71587]: Fix crash in C version of
datetime.datetime.strptime()
when called again on the restarted interpreter.gh-120161 [https://github.com/python/cpython/issues/120161]:
datetime
no longer crashes in certain complex reference cycle situations.gh-119698 [https://github.com/python/cpython/issues/119698]: Fix
symtable.Class.get_methods()
and document its behaviour. Patch by Bénédikt Tran.gh-120121 [https://github.com/python/cpython/issues/120121]: Add
concurrent.futures.InvalidStateError
to module's__all__
.gh-119933 [https://github.com/python/cpython/issues/119933]: Add the
symtable.SymbolTableType
enumeration to represent the possible outputs of thesymtable.SymbolTable.get_type
method. Patch by Bénédikt Tran.gh-120108 [https://github.com/python/cpython/issues/120108]: Fix calling
copy.deepcopy()
onast
trees that have been modified to have references to parent nodes. Patch by Jelle Zijlstra.gh-112672 [https://github.com/python/cpython/issues/112672]: Support building
tkinter
with Tcl 9.0.gh-65454 [https://github.com/python/cpython/issues/65454]:
unittest.mock.Mock.attach_mock()
no longer triggers a call to aPropertyMock
being attached.gh-81936 [https://github.com/python/cpython/issues/81936]:
help()
andshowtopic()
methods now respect a configured output argument topydoc.Helper
and not use the pager in such cases. Patch by Enrico Tröger.gh-119577 [https://github.com/python/cpython/issues/119577]: The
DeprecationWarning
emitted when testing the truth value of anxml.etree.ElementTree.Element
now describes unconditionally returningTrue
in a future version rather than raising an exception in Python 3.14.gh-118908 [https://github.com/python/cpython/issues/118908]: Limit exposed globals from internal imports and definitions on new REPL startup. Patch by Eugene Triguba and Pablo Galindo.
gh-119506 [https://github.com/python/cpython/issues/119506]: Fix
io.TextIOWrapper.write()
method breaks internal buffer when the method is called again during flushing internal buffer.
构建
gh-120671 [https://github.com/python/cpython/issues/120671]: Fix failing configure tests due to a missing space when appending to CFLAGS.
gh-120602 [https://github.com/python/cpython/issues/120602]: Correctly handle LLVM installs with
LLVM_VERSION_SUFFIX
when building with--enable-experimental-jit
.gh-120326 [https://github.com/python/cpython/issues/120326]: On Windows, fix build error when
--disable-gil
and--experimental-jit
options are combined.gh-120291 [https://github.com/python/cpython/issues/120291]: Make the
python-config
shell script compatible with non-bash shells.
C API
gh-120642 [https://github.com/python/cpython/issues/120642]: Remove the private
PyCODEUNIT
type from the public C API. The internalpycore_code.h
header should now be used to get this internal type. Patch by Victor Stinner.gh-120858 [https://github.com/python/cpython/issues/120858]:
PyDict_Next()
no longer locks the dictionary in the free-threaded build. The locking needs to be done by the caller around the entire iteration loop.gh-120642 [https://github.com/python/cpython/issues/120642]: Remove the following unstable functions:
PyUnstable_Replace_Executor()
PyUnstable_SetOptimizer()
PyUnstable_GetOptimizer()
PyUnstable_GetExecutor()
PyUnstable_Optimizer_NewCounter()
PyUnstable_Optimizer_NewUOpOptimizer()
Patch by Victor Stinner.
gh-119344 [https://github.com/python/cpython/issues/119344]: The critical section API is now public as part of the non-limited C API.
gh-118789 [https://github.com/python/cpython/issues/118789]: Add
PyUnstable_Object_ClearWeakRefsNoCallbacks()
, which clears weakrefs without calling their callbacks.gh-117511 [https://github.com/python/cpython/issues/117511]: Make the
PyMutex
public in the non-limited C API.
Python 3.13.0 beta 2
Release date: 2024-06-05
安全性
gh-118773 [https://github.com/python/cpython/issues/118773]: Fixes creation of ACLs in
os.mkdir()
on Windows to work correctly on non-English machines.gh-118486 [https://github.com/python/cpython/issues/118486]:
os.mkdir()
on Windows now accepts mode of0o700
to restrict the new directory to the current user. This fixes CVE 2024-4030 [https://www.cve.org/CVERecord?id=CVE-2024-4030] affectingtempfile.mkdtemp()
in scenarios where the base temporary directory is more permissive than the default.
核心与内置函数
gh-119724 [https://github.com/python/cpython/issues/119724]: Reverted improvements to error messages for
elif
/else
statements not matching any valid statements, which made in hard to locate the syntax errors inside thoseelif
/else
blocks.gh-119842 [https://github.com/python/cpython/issues/119842]: Honor
PyOS_InputHook()
in the new REPL. Patch by Pablo Galindogh-119821 [https://github.com/python/cpython/issues/119821]: Fix execution of annotation scopes within classes when
globals
is set to a non-dict. Patch by Jelle Zijlstra.gh-119548 [https://github.com/python/cpython/issues/119548]: Add a
clear
command to the REPL. Patch by Pablo Galindogh-111999 [https://github.com/python/cpython/issues/111999]: Fix the signature of
str.format_map()
.gh-119560 [https://github.com/python/cpython/issues/119560]: An invalid assert in beta 1 has been removed. The assert would fail if
PyState_FindModule()
was used in an extension module's init function before the module def had been initialized.gh-119369 [https://github.com/python/cpython/issues/119369]: Fix deadlock during thread deletion in free-threaded build, which could occur when the GIL was enabled at runtime.
gh-119525 [https://github.com/python/cpython/issues/119525]: Fix deadlock involving
PyTypeLookup()
cache in the free-threaded build when the GIL is dynamically enabled at runtime.gh-119311 [https://github.com/python/cpython/issues/119311]: Fix bug where names are unexpectedly mangled in the bases of generic classes.
gh-119395 [https://github.com/python/cpython/issues/119395]: Fix bug where names appearing after a generic class are mangled as if they are in the generic class.
gh-119213 [https://github.com/python/cpython/issues/119213]: Non-builtin modules built with argument clinic were crashing if used in a subinterpreter before the main interpreter. The objects that were causing the problem by leaking between interpreters carelessly have been fixed.
gh-119011 [https://github.com/python/cpython/issues/119011]: Fixes
type.__type_params__
to return an empty tuple instead of a descriptor.gh-118692 [https://github.com/python/cpython/issues/118692]: Avoid creating unnecessary
StopIteration
instances for monitoring.gh-119049 [https://github.com/python/cpython/issues/119049]: Fix displaying the source line for warnings created by the C API if the
warnings
module had not yet been imported.gh-118844 [https://github.com/python/cpython/issues/118844]: Fix build failures when configuring with both
--disable-gil
and--enable-experimental-jit
.gh-118921 [https://github.com/python/cpython/issues/118921]: Add
copy()
method forFrameLocalsProxy
which returns a snapshotdict
for local variables.gh-117657 [https://github.com/python/cpython/issues/117657]: Fix data races on the field that stores a pointer to the interpreter's main thread that occur in free-threaded builds.
gh-118561 [https://github.com/python/cpython/issues/118561]: Fix race condition in free-threaded build where
list.extend()
could expose uninitialised memory to concurrent readers.gh-117195 [https://github.com/python/cpython/issues/117195]: Avoid assertion failure for debug builds when calling
object.__sizeof__(1)
库
gh-119819 [https://github.com/python/cpython/issues/119819]: Fix regression to allow logging configuration with multiprocessing queue types.
gh-117142 [https://github.com/python/cpython/issues/117142]: The
ctypes
module may now be imported in all subinterpreters, including those that have their own GIL.gh-118835 [https://github.com/python/cpython/issues/118835]: Fix _pyrepl crash when using custom prompt with ANSI escape codes.
gh-117398 [https://github.com/python/cpython/issues/117398]: The
_datetime
module (C implementation fordatetime
) now supports being imported in multiple interpreters.gh-89727 [https://github.com/python/cpython/issues/89727]: Fix issue with
shutil.rmtree()
where aRecursionError
is raised on deep directory trees.gh-89727 [https://github.com/python/cpython/issues/89727]: Partially fix issue with
shutil.rmtree()
where aRecursionError
is raised on deep directory trees. A recursion error is no longer raised whenrmtree.avoids_symlink_attacks
is false.gh-119118 [https://github.com/python/cpython/issues/119118]: Fix performance regression in the
tokenize
module by caching theline
token attribute and calculating the column offset more efficiently.gh-89727 [https://github.com/python/cpython/issues/89727]: Fix issue with
os.fwalk()
where aRecursionError
was raised on deep directory trees by adjusting the implementation to be iterative instead of recursive.gh-119588 [https://github.com/python/cpython/issues/119588]:
zipfile.Path.is_symlink
now assesses if the given path is a symlink.gh-119555 [https://github.com/python/cpython/issues/119555]: Catch
SyntaxError
fromcompile()
in the runsource() method of the InteractiveColoredConsole. Patch by Sergey B Kirpichev.gh-113892 [https://github.com/python/cpython/issues/113892]: Now, the method
sock_connect
ofasyncio.ProactorEventLoop
raises aValueError
if given socket is not in nonblocking mode, as well as in other loop implementations.gh-119443 [https://github.com/python/cpython/issues/119443]: The interactive REPL no longer runs with
from __future__ import annotations
enabled. Patch by Jelle Zijlstra.gh-117398 [https://github.com/python/cpython/issues/117398]: Objects in the datetime C-API are now all statically allocated, which means better memory safety, especially when the module is reloaded. This should be transparent to users.
gh-118894 [https://github.com/python/cpython/issues/118894]:
asyncio
REPL now has the same capabilities as PyREPL.gh-118911 [https://github.com/python/cpython/issues/118911]: In PyREPL, updated
maybe-accept
's logic so that if the user hits Enter twice, they are able to terminate the block even if there's trailing whitespace. Also, now when the user hits arrow up, the cursor is on the last functional line. This matches IPython's behavior. Patch by Aya Elsayed.gh-111201 [https://github.com/python/cpython/issues/111201]: Remove dependency to
readline
from the new Python REPL.gh-119174 [https://github.com/python/cpython/issues/119174]: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry Patch by Wulian233 and Terry Jan Reedy
gh-119121 [https://github.com/python/cpython/issues/119121]: Fix a NameError happening in
asyncio.staggered.staggered_race
. This function is now tested.gh-119113 [https://github.com/python/cpython/issues/119113]: Fix issue where
pathlib.PurePath.with_suffix()
didn't raiseTypeError
when givenNone
as a suffix.gh-118643 [https://github.com/python/cpython/issues/118643]: Fix an AttributeError in the
email
module when re-fold a long address list. Also fix more cases of incorrect encoding of the address separator in the address list.gh-58933 [https://github.com/python/cpython/issues/58933]: Make
pdb
return to caller frame correctly whenf_trace
of the caller frame is not setgh-118895 [https://github.com/python/cpython/issues/118895]: Setting attributes on
typing.NoDefault
now raisesAttributeError
instead ofTypeError
.gh-118868 [https://github.com/python/cpython/issues/118868]: Fixed issue where kwargs were no longer passed to the logging handler QueueHandler
gh-118851 [https://github.com/python/cpython/issues/118851]:
ctx
arguments to the constructors ofast
node classes now default toast.Load()
. Patch by Jelle Zijlstra.gh-118760 [https://github.com/python/cpython/issues/118760]: Restore the default value of
tkiter.wantobjects
to1
.gh-118760 [https://github.com/python/cpython/issues/118760]: Fix errors in calling Tkinter bindings on Windows.
gh-118507 [https://github.com/python/cpython/issues/118507]: Fix
os.path.isfile()
on Windows for pipes. Speedupos.path.isjunction()
andos.path.lexists()
on Windows with a native implementation.gh-118772 [https://github.com/python/cpython/issues/118772]: Allow
typing.TypeVar
instances without a default to follow instances without a default in some cases. Patch by Jelle Zijlstra.gh-110863 [https://github.com/python/cpython/issues/110863]:
os.path.realpath()
now suppresses anyOSError
fromos.readlink()
when strict mode is disabled (the default).gh-118263 [https://github.com/python/cpython/issues/118263]: Speed up
os.path.splitroot()
&os.path.normpath()
with a direct C call.gh-118033 [https://github.com/python/cpython/issues/118033]: Fix
dataclasses.dataclass()
not creating a__weakref__
slot when subclassingtyping.Generic
.gh-106531 [https://github.com/python/cpython/issues/106531]: In
importlib.resources
, sync with importlib_resources 6.3.2 [https://importlib-resources.readthedocs.io/en/latest/history.html#v6-3-2], including:MultiplexedPath
now expectsTraversable
paths, deprecating string arguments toMultiplexedPath
; Enabled support for resources in namespace packages in zip files; FixedNotADirectoryError
when calling files on a subdirectory of a namespace package.gh-113978 [https://github.com/python/cpython/issues/113978]: Ignore warnings on text completion inside REPL.
gh-103956 [https://github.com/python/cpython/issues/103956]: Fix lack of newline characters in
trace
module output when line tracing is enabled but source code line for current frame is not available.gh-92081 [https://github.com/python/cpython/issues/92081]: Fix missing spaces in email headers when the spaces are mixed with encoded 8-bit characters.
gh-103194 [https://github.com/python/cpython/issues/103194]: Prepare Tkinter for C API changes in Tcl 8.7/9.0 to avoid
tkinter.TclObj
being unexpectedly returned instead ofbool
,str
,bytearray
, orint
.gh-87106 [https://github.com/python/cpython/issues/87106]: Fixed handling in
inspect.Signature.bind()
of keyword arguments having the same name as positional-only arguments when a variadic keyword argument (e.g.**kwargs
) is present.bpo-45767 [https://bugs.python.org/issue?@action=redirect&bpo=45767]: Fix integer conversion in
os.major()
,os.minor()
, andos.makedev()
. Support device numbers larger than2**63-1
. Support nonexistent device number (NODEV
).gh-67693 [https://github.com/python/cpython/issues/67693]: Fix
urllib.parse.urlunparse()
andurllib.parse.urlunsplit()
for URIs with path starting with multiple slashes and no authority. Based on patch by Ashwin Ramaswami.
测试
- gh-119050 [https://github.com/python/cpython/issues/119050]: regrtest test runner: Add XML support to the refleak checker (-R option). Patch by Victor Stinner.
构建
gh-119729 [https://github.com/python/cpython/issues/119729]: On POSIX systems, the pkg-config (
.pc
) filenames now include the ABI flags, which may include debug ("d") and free-threaded ("t"). For example:python3.14.pc
(default, non-debug build)python3.14d.pc
(default, debug build) *python3.14t.pc
(free-threaded build)gh-115119 [https://github.com/python/cpython/issues/115119]: Fall back to the bundled libmpdec if a system version cannot be found.
gh-119132 [https://github.com/python/cpython/issues/119132]: Update
sys.version
to identify whether the build is default build or free-threading build. Patch By Donghee Na.gh-118836 [https://github.com/python/cpython/issues/118836]: Fix an
AssertionError
when building with--enable-experimental-jit
and the compiler emits aSHT_NOTE
section.gh-118943 [https://github.com/python/cpython/issues/118943]: Fix a possible race condition affecting parallel builds configured with
--enable-experimental-jit
, in which compilation errors could be caused by an incompletely-generated header file.
Windows
gh-119679 [https://github.com/python/cpython/issues/119679]: Ensures correct import libraries are included in Windows installs.
gh-119690 [https://github.com/python/cpython/issues/119690]: Adds Unicode support and fixes audit events for
_winapi.CreateNamedPipe
.gh-111201 [https://github.com/python/cpython/issues/111201]: Add support for new pyrepl on Windows
gh-119070 [https://github.com/python/cpython/issues/119070]: Fixes
py.exe
handling of shebangs likeusrbin/env python3.12
, which were previously interpreted aspython3.exe
instead ofpython3.12.exe
.gh-117505 [https://github.com/python/cpython/issues/117505]: Fixes an issue with the Windows installer not running ensurepip in a fully isolated environment. This could cause unexpected interactions with the user site-packages.
gh-118209 [https://github.com/python/cpython/issues/118209]: Avoid crashing in
mmap
on Windows when the mapped memory is inaccessible due to file system errors or access violations.gh-116145 [https://github.com/python/cpython/issues/116145]: Updated bundled Tcl/Tk to 8.6.14.
C API
gh-119585 [https://github.com/python/cpython/issues/119585]: Fix crash when a thread state that was created by
PyGILState_Ensure()
calls a destructor that duringPyThreadState_Clear()
that calls back intoPyGILState_Ensure()
andPyGILState_Release()
. This might occur when in the free-threaded build or when using thread-local variables whose destructors callPyGILState_Ensure()
.gh-119336 [https://github.com/python/cpython/issues/119336]: Restore the removed
PyLongNumBits()
function. It is used by the pywin32 project. Patch by Ethan Smithgh-119247 [https://github.com/python/cpython/issues/119247]: Added
Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST
andPy_END_CRITICAL_SECTION_SEQUENCE_FAST
macros to make it possible to use PySequence_Fast APIs safely when free-threaded, and update str.join to work without the GIL using them.gh-111389 [https://github.com/python/cpython/issues/111389]: Add
PyHASH_MULTIPLIER
constant: prime multiplier used in string and various other hashes. Patch by Victor Stinner.gh-116984 [https://github.com/python/cpython/issues/116984]: Make mimalloc includes relative to the current file to avoid embedders or extensions needing to include
Internal/mimalloc
if they are already including internal CPython headers.gh-118789 [https://github.com/python/cpython/issues/118789]: Restore
PyWeakrefClearRef
that was previously removed in Python 3.13 alpha 1.
Python 3.13.0 beta 1
Release date: 2024-05-08
安全性
gh-116741 [https://github.com/python/cpython/issues/116741]: Update bundled libexpat to 2.6.2
gh-117233 [https://github.com/python/cpython/issues/117233]: Detect BLAKE2, SHA3, Shake, & truncated SHA512 support in the OpenSSL-ish libcrypto library at build time. This allows
hashlib
to be used with libraries that do not to support every algorithm that upstream OpenSSL does.
核心与内置函数
gh-118414 [https://github.com/python/cpython/issues/118414]: Add instrumented opcodes to YIELD_VALUE assertion for tracing cases.
gh-117953 [https://github.com/python/cpython/issues/117953]: When a builtin or extension module is imported for the first time, while a subinterpreter is active, the module's init function is now run by the main interpreter first before import continues in the subinterpreter. Consequently, single-phase init modules now fail in an isolated subinterpreter without the init function running under that interpreter, whereas before it would run under the subinterpreter before failing, potentially leaving behind global state and callbacks and otherwise leaving the module in an inconsistent state.
gh-117549 [https://github.com/python/cpython/issues/117549]: Don't use designated initializer syntax in inline functions in internal headers. They cause problems for C++ or MSVC users who aren't yet using the latest C++ standard (C++20). While internal, pycore_backoff.h, is included (indirectly, via pycore_code.h) by some key 3rd party software that does so for speed.
gh-95382 [https://github.com/python/cpython/issues/95382]: Improve performance of
json.dumps()
andjson.dump()
when using the argument indent. Depending on the data the encoding usingjson.dumps()
with indent can be up to 2 to 3 times faster.gh-116322 [https://github.com/python/cpython/issues/116322]: In
--disable-gil
builds, the GIL will be enabled while loading C extension modules. If the module indicates that it supports running without the GIL, the GIL will be disabled once loading is complete. Otherwise, the GIL will remain enabled for the remainder of the interpreter's lifetime. This behavior does not apply if the GIL has been explicitly enabled or disabled withPYTHON_GIL
or-Xgil
.gh-118513 [https://github.com/python/cpython/issues/118513]: Fix incorrect
UnboundLocalError
when two comprehensions in the same function both reference the same name, and in one comprehension the name is bound while in the other it's an implicit global.gh-118518 [https://github.com/python/cpython/issues/118518]: Allow the Linux perf support to work without frame pointers using perf's advanced JIT support. The feature is activated when using the
PYTHON_PERF_JIT_SUPPORT
environment variable or when running Python with-Xperf_jit
. Patch by Pablo Galindo.gh-117514 [https://github.com/python/cpython/issues/117514]: Add
sys._is_gil_enabled()
function that returns whether the GIL is currently enabled. In the default build it always returnsTrue
because the GIL is always enabled. In the free-threaded build, it may returnTrue
orFalse
.gh-118164 [https://github.com/python/cpython/issues/118164]: Break a loop between the Python implementation of the
decimal
module and the Python code for integer to string conversion. Also optimize integer to string conversion for values in the range from 9_000 to 135_000 decimal digits.gh-118473 [https://github.com/python/cpython/issues/118473]: Fix
sys.set_asyncgen_hooks()
not to be partially set when raisingTypeError
.gh-118465 [https://github.com/python/cpython/issues/118465]: Compiler populates the new
__firstlineno__
field on a class with the line number of the first line of the class definition.gh-118492 [https://github.com/python/cpython/issues/118492]: Fix an issue where the type cache can expose a previously accessed attribute when a finalizer is run.
gh-117714 [https://github.com/python/cpython/issues/117714]: update
async_generator.athrow().close()
andasync_generator.asend().close()
to close their section of the underlying async generatorgh-111201 [https://github.com/python/cpython/issues/111201]: The interactive interpreter is now implemented in Python, which allows for a number of new features like colors, multiline input, history viewing, and paste mode. Contributed by Pablo Galindo, Łukasz Langa and Lysandros Nikolaou based on code from the PyPy project.
gh-74929 [https://github.com/python/cpython/issues/74929]: Implement PEP 667: converted
FrameType.f_locals
andPyFrame_GetLocals()
to return a write-through proxy object when the frame refers to a function or comprehension.gh-116767 [https://github.com/python/cpython/issues/116767]: Fix crash in compiler on 'async with' that has many context managers.
gh-118335 [https://github.com/python/cpython/issues/118335]: Change how to use the tier 2 interpreter. Instead of running Python with
-X uops
or setting the environment variablePYTHON_UOPS=1
, this choice is now made at build time by configuring with--enable-experimental-jit=interpreter
.
Beware! This changes the environment variable to enable or disable microops to PYTHON_JIT
. The old PYTHON_UOPS
is no longer used.
gh-118306 [https://github.com/python/cpython/issues/118306]: Update JIT compilation to use LLVM 18
gh-118160 [https://github.com/python/cpython/issues/118160]: Annotation scopes within classes can now contain comprehensions. However, such comprehensions are not inlined into their parent scope at runtime. Patch by Jelle Zijlstra.
gh-118272 [https://github.com/python/cpython/issues/118272]: Fix bug where
generator.close
does not free the generator frame's locals.gh-118216 [https://github.com/python/cpython/issues/118216]: Don't consider
__future__
imports with dots before the module name.gh-118074 [https://github.com/python/cpython/issues/118074]: Make sure that the Executor objects in the COLD_EXITS array aren't assumed to be GC-able (which would access bytes outside the object).
gh-107674 [https://github.com/python/cpython/issues/107674]: Lazy load frame line number to improve performance of tracing
gh-118082 [https://github.com/python/cpython/issues/118082]: Improve
SyntaxError
message for imports without names, like infrom x import
andimport
cases. It now points out to users thatimport
expects at least one name after it.gh-118090 [https://github.com/python/cpython/issues/118090]: Improve
SyntaxError
message for empty type param brackets.gh-117958 [https://github.com/python/cpython/issues/117958]: Added a
get_jit_code()
method to access JIT compiled machine code from the UOp Executor when the experimental JIT is enabled. Patch by Anthony Shaw.gh-117901 [https://github.com/python/cpython/issues/117901]: Add option for compiler's codegen to save nested instruction sequences for introspection.
gh-116622 [https://github.com/python/cpython/issues/116622]: Redirect stdout and stderr to system log when embedded in an Android app.
gh-109118 [https://github.com/python/cpython/issues/109118]: annotation scope within class scopes can now contain lambdas.
gh-117894 [https://github.com/python/cpython/issues/117894]: Prevent
agen.aclose()
objects being re-used after.throw()
.gh-117881 [https://github.com/python/cpython/issues/117881]: prevent concurrent access to an async generator via athrow().throw() or asend().throw()
gh-117536 [https://github.com/python/cpython/issues/117536]: Fix a
RuntimeWarning
when callingagen.aclose().throw(Exception)
.gh-117755 [https://github.com/python/cpython/issues/117755]: Fix mimalloc allocator for huge memory allocation (around 8,589,934,592 GiB) on s390x. Patch by Victor Stinner.
gh-117750 [https://github.com/python/cpython/issues/117750]: Fix issue where an object's dict would get out of sync with the object's internal values when being cleared.
obj.__dict__.clear()
now clears the internal values, but leaves the dict attached to the object.gh-117431 [https://github.com/python/cpython/issues/117431]: Improve the performance of the following
bytes
andbytearray
methods by adapting them to theMETH_FASTCALL
calling convention:count()
find()
index()
rfind()
rindex()
gh-117709 [https://github.com/python/cpython/issues/117709]: Speed up calls to
str()
with positional-only argument, by using the PEP 590 [https://peps.python.org/pep-0590/]vectorcall
calling convention. Patch by Erlend Aasland.gh-117680 [https://github.com/python/cpython/issues/117680]: Give
_PyInstructionSequence
a Python interface and use it in tests.gh-115776 [https://github.com/python/cpython/issues/115776]: Statically allocated objects are, by definition, immortal so must be marked as such regardless of whether they are in extension modules or not.
gh-117385 [https://github.com/python/cpython/issues/117385]: Remove unhandled
PY_MONITORING_EVENT_BRANCH
andPY_MONITORING_EVENT_EXCEPTION_HANDLED
events fromsys.settrace()
.gh-116322 [https://github.com/python/cpython/issues/116322]: Extension modules may indicate to the runtime that they can run without the GIL. Multiphase init modules do so by calling providing
Py_MOD_GIL_NOT_USED
for thePy_mod_gil
slot, while single-phase init modules callPyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED)
from their init function.gh-116129 [https://github.com/python/cpython/issues/116129]: Implement PEP 696 [https://peps.python.org/pep-0696/], adding support for defaults on type parameters. Patch by Jelle Zijlstra.
gh-93502 [https://github.com/python/cpython/issues/93502]: Add two new functions to the C-API,
PyRefTracer_SetTracer()
andPyRefTracer_GetTracer()
, that allows to track object creation and destruction the same way thetracemalloc
module does. Patch by Pablo Galindogh-107674 [https://github.com/python/cpython/issues/107674]: Improved the performance of
sys.settrace()
significantlygh-95754 [https://github.com/python/cpython/issues/95754]: Improve the error message when a script shadowing a module from the standard library causes
AttributeError
to be raised. Similarly, improve the error message when a script shadowing a third party module attempts to access an attribute from that third party module while still initialising.gh-99180 [https://github.com/python/cpython/issues/99180]: Elide uninformative traceback indicators in
return
and simpleassignment
statements. Patch by Pablo Galindo.gh-105879 [https://github.com/python/cpython/issues/105879]: Allow the globals and locals arguments to
exec()
andeval()
to be passed as keywords.