安全性
gh-108310 [https://github.com/python/cpython/issues/108310]: Fixed an issue where instances of
ssl.SSLSocket
were vulnerable to a bypass of the TLS handshake and included protections (like certificate verification) and treating sent unencrypted data as if it were post-handshake TLS encrypted data. Security issue reported as CVE 2023-40217 [https://www.cve.org/CVERecord?id=CVE-2023-40217] by Aapo Oksman. Patch by Gregory P. Smith.gh-107774 [https://github.com/python/cpython/issues/107774]: PEP 669 specifies that
sys.monitoring.register_callback
will generate an audit event. Prereleases of Python 3.12 did not generate the audit event. This is now fixed.gh-102988 [https://github.com/python/cpython/issues/102988]: Reverted the
email.utils
security improvement change released in 3.12beta4 that unintentionally causedemail.utils.getaddresses
to fail to parse email addresses with a comma in the quoted name field. See gh-106669 [https://github.com/python/cpython/issues/106669].gh-99108 [https://github.com/python/cpython/issues/99108]: Refresh our new HACL* builtin
hashlib
code from upstream. Builtin SHA2 should be faster and an issue with SHA3 on 32-bit platforms is fixed.gh-102509 [https://github.com/python/cpython/issues/102509]: Start initializing
ob_digit
during creation ofPyLongObject
objects. Patch by Illia Volochii.
核心与内置函数
gh-110782 [https://github.com/python/cpython/issues/110782]: Fix crash when
typing.TypeVar
is constructed with a keyword argument. Patch by Jelle Zijlstra.gh-110752 [https://github.com/python/cpython/issues/110752]: Reset
ceval.eval_breaker
ininterpreter_clear()
gh-110721 [https://github.com/python/cpython/issues/110721]: Use the
traceback
implementation for the defaultPyErr_Display()
functionality. Patch by Pablo Galindogh-110696 [https://github.com/python/cpython/issues/110696]: Fix incorrect error message for invalid argument unpacking. Patch by Pablo Galindo
gh-104169 [https://github.com/python/cpython/issues/104169]: Split the tokenizer into two separate directories: - One part includes the actual lexeme producing logic and lives in
Parser/lexer
. - The second part wraps the lexer according to the different tokenization modes we have (string, utf-8, file, interactive, readline) and lives inParser/tokenizer
.gh-110688 [https://github.com/python/cpython/issues/110688]: Remove undocumented
test_c_api
method fromset
, which was only defined for testing purposes underPy_DEBUG
. Now we have proper CAPI tests.gh-104584 [https://github.com/python/cpython/issues/104584]: Fix a reference leak when running with
PYTHONUOPS
or-X uops
enabled.gh-110514 [https://github.com/python/cpython/issues/110514]: Add
PY_THROW
tosys.setprofile()
eventsgh-110489 [https://github.com/python/cpython/issues/110489]: Optimise
math.ceil()
when the input is exactly a float, resulting in about a 10% improvement.gh-110455 [https://github.com/python/cpython/issues/110455]: Guard
assert(tstate->thread_id > 0)
with#ifndef HAVE_PTHREAD_STUBS
. This allows for for pydebug builds to work under WASI which (currently) lacks thread support.gh-110309 [https://github.com/python/cpython/issues/110309]: Remove unnecessary empty constant nodes in the ast of fstring specs.
gh-110259 [https://github.com/python/cpython/issues/110259]: Correctly identify the format spec in fstrings (with single or triple quotes) that have multiple lines in the expression part and include a formatting spec. Patch by Pablo Galindo
gh-110237 [https://github.com/python/cpython/issues/110237]: Fix missing error checks for calls to
PyList_Append
inPyEvalMatchClass
.gh-110164 [https://github.com/python/cpython/issues/110164]: regrtest: If the
SOURCE_DATE_EPOCH
environment variable is defined, regrtest now disables tests randomization. Patch by Victor Stinner.gh-109889 [https://github.com/python/cpython/issues/109889]: Fix the compiler's redundant NOP detection algorithm to skip over NOPs with no line number when looking for the next instruction's lineno.
gh-109853 [https://github.com/python/cpython/issues/109853]:
sys.path[0]
is now set correctly for subinterpreters.gh-109923 [https://github.com/python/cpython/issues/109923]: Set line number on the
POP_TOP
that follows aRETURN_GENERATOR
.gh-105716 [https://github.com/python/cpython/issues/105716]: Subinterpreters now correctly handle the case where they have threads running in the background. Before, such threads would interfere with cleaning up and destroying them, as well as prevent running another script.
gh-109369 [https://github.com/python/cpython/issues/109369]: The internal eval_breaker and supporting flags, plus the monitoring version have been merged into a single atomic integer to speed up checks.
gh-109823 [https://github.com/python/cpython/issues/109823]: Fix bug where compiler does not adjust labels when removing an empty basic block which is a jump target.
gh-109793 [https://github.com/python/cpython/issues/109793]: The main thread no longer exits prematurely when a subinterpreter is cleaned up during runtime finalization. The bug was a problem particularly because, when triggered, the Python process would always return with a 0 exitcode, even if it failed.
gh-109719 [https://github.com/python/cpython/issues/109719]: Fix missing jump target labels when compiler reorders cold/warm blocks.
gh-109595 [https://github.com/python/cpython/issues/109595]: Add
-X cpu_count
command line option to override return results ofos.cpu_count()
andos.process_cpu_count()
. This option is useful for users who need to limit CPU resources of a container system without having to modify the container (application code). Patch by Donghee Na.gh-109627 [https://github.com/python/cpython/issues/109627]: Fix bug where the compiler does not assign a new jump target label to a duplicated small exit block.
gh-109596 [https://github.com/python/cpython/issues/109596]: Fix some tokens in the grammar that were incorrectly marked as soft keywords. Also fix some repeated rule names and ensure that repeated rules are not allowed. Patch by Pablo Galindo
gh-109496 [https://github.com/python/cpython/issues/109496]: On a Python built in debug mode,
Py_DECREF()
now callsPyNegativeRefcount()
if the object is a dangling pointer to deallocated memory: memory filled with0xDD
"dead byte" by the debug hook on memory allocators. The fix is to check the reference count before checking forPyIsImmortal()
. Patch by Victor Stinner.gh-107265 [https://github.com/python/cpython/issues/107265]: Deopt opcodes hidden by the executor when base opcode is needed
gh-109371 [https://github.com/python/cpython/issues/109371]: Deopted instructions correctly for tool initialization and modified the incorrect assertion in instrumentation, when a previous tool already sets INSTRUCTION events
gh-105658 [https://github.com/python/cpython/issues/105658]: Fix bug where the line trace of an except block ending with a conditional includes an excess event with the line of the conditional expression.
gh-109219 [https://github.com/python/cpython/issues/109219]: Fix compiling type param scopes that use a name which is also free in an inner scope.
gh-109351 [https://github.com/python/cpython/issues/109351]: Fix crash when compiling an invalid AST involving a named (walrus) expression.
gh-109341 [https://github.com/python/cpython/issues/109341]: Fix crash when compiling an invalid AST involving a
ast.TypeAlias
.gh-109195 [https://github.com/python/cpython/issues/109195]: Fix source location for the
LOAD_*
instruction preceding aLOAD_SUPER_ATTR
to load thesuper
global (or shadowing variable) so that it encompasses only the namesuper
and not the following parentheses.gh-109256 [https://github.com/python/cpython/issues/109256]: Opcode IDs for specialized opcodes are allocated in their own range to improve stability of the IDs for the 'real' opcodes.
gh-109216 [https://github.com/python/cpython/issues/109216]: Fix possible memory leak in
BUILD_MAP
.gh-109207 [https://github.com/python/cpython/issues/109207]: Fix a SystemError in
_repr_
of symtable entry object.gh-109179 [https://github.com/python/cpython/issues/109179]: Fix bug where the C traceback display drops notes from
SyntaxError
.gh-109118 [https://github.com/python/cpython/issues/109118]: Disallow nested scopes (lambdas, generator expressions, and comprehensions) within PEP 695 annotation scopes that are nested within classes.
gh-109156 [https://github.com/python/cpython/issues/109156]: Add tests for de-instrumenting instructions while keeping the instrumentation for lines
gh-109114 [https://github.com/python/cpython/issues/109114]: Relax the detection of the error message for invalid lambdas inside fstrings to not search for arbitrary replacement fields to avoid false positives. Patch by Pablo Galindo
gh-105848 [https://github.com/python/cpython/issues/105848]: Add a new
CALL_KW
opcode, used for calls containing keyword arguments. Also, fix a possible crash when jumping over method calls in a debugger.gh-109052 [https://github.com/python/cpython/issues/109052]: Use the base opcode when comparing code objects to avoid interference from instrumentation
gh-109118 [https://github.com/python/cpython/issues/109118]: Fix interpreter crash when a NameError is raised inside the type parameters of a generic class.
gh-88943 [https://github.com/python/cpython/issues/88943]: Improve syntax error for nonASCII character that follows a numerical literal. It now points on the invalid nonASCII character, not on the valid numerical literal.
gh-108976 [https://github.com/python/cpython/issues/108976]: Fix crash that occurs after de-instrumenting a code object in a monitoring callback.
gh-108732 [https://github.com/python/cpython/issues/108732]: Make iteration variables of module-and class-scoped comprehensions visible to pdb and other tools that use
frame.f_locals
again.gh-108959 [https://github.com/python/cpython/issues/108959]: Fix caret placement for error locations for subscript and binary operations that involve non-semantic parentheses and spaces. Patch by Pablo Galindo
gh-104584 [https://github.com/python/cpython/issues/104584]: Fix a crash when running with
PYTHONUOPS
or-X uops
enabled and an error occurs during optimization.gh-108727 [https://github.com/python/cpython/issues/108727]: Define
tp_dealloc
forCounterOptimizer_Type
. This fixes a segfault on deallocation.gh-108520 [https://github.com/python/cpython/issues/108520]: Fix
multiprocessing.synchronize.SemLock.__setstate__()
to properly initializemultiprocessing.synchronize.SemLock._is_fork_ctx
. This fixes a regression when passing a SemLock across nested processes.
Rename multiprocessing.synchronize.SemLock.is_fork_ctx
to multiprocessing.synchronize.SemLock._is_fork_ctx
to avoid exposing it as public API.
gh-108654 [https://github.com/python/cpython/issues/108654]: Restore locals shadowed by an inlined comprehension if the comprehension raises an exception.
gh-108488 [https://github.com/python/cpython/issues/108488]: Change the initialization of inline cache entries so that the cache entry for
JUMP_BACKWARD
is initialized to zero, instead of theadaptive_counter_warmup()
value used for all other instructions. This counter, unique among instructions, counts up from zero.gh-108716 [https://github.com/python/cpython/issues/108716]: Turn off deepfreezing of code objects. Modules are still frozen, so that a file system search is not needed for common modules.
gh-108614 [https://github.com/python/cpython/issues/108614]: Add RESUME_CHECK instruction, to avoid having to handle instrumentation, signals, and contexts switches in the tier 2 execution engine.
gh-108487 [https://github.com/python/cpython/issues/108487]: Move an assert that would cause a spurious crash in a devious case that should only trigger deoptimization.
gh-106176 [https://github.com/python/cpython/issues/106176]: Use a
WeakValueDictionary
to track the lists containing the modules each thread is currently importing. This helps avoid a reference leak from keeping the list around longer than necessary. Weakrefs are used as GC can't interrupt the cleanup.gh-105481 [https://github.com/python/cpython/issues/105481]: The regen-opcode build stage was removed and its work is now done in regen-cases.
gh-107901 [https://github.com/python/cpython/issues/107901]: Fix missing line number on
JUMP_BACKWARD
at the end of a for loop.gh-108113 [https://github.com/python/cpython/issues/108113]: The
compile()
builtin can now accept a new flag,ast.PyCF_OPTIMIZED_AST
, which is similar toast.PyCF_ONLY_AST
except that the returnedAST
is optimized according to the value of theoptimize
argument.
ast.parse()
now accepts an optional argument optimize
which is passed on to the compile()
builtin. This makes it possible to obtain an optimized AST
.
gh-107971 [https://github.com/python/cpython/issues/107971]: Opcode IDs are generated from bytecodes.c instead of being hard coded in opcode.py.
gh-107944 [https://github.com/python/cpython/issues/107944]: Improve error message for function calls with bad keyword arguments. Patch by Pablo Galindo
gh-108390 [https://github.com/python/cpython/issues/108390]: Raise an exception when setting a nonlocal event (
RAISE
,EXCEPTION_HANDLED
, etc.) insys.monitoring.set_local_events
.
Fixes crash when tracing in recursive calls to Python classes.
gh-108035 [https://github.com/python/cpython/issues/108035]: Remove the
_PyCFrame
struct, moving the pointer to the current interpreter frame back to the threadstate, as it was for 3.10 and earlier. The_PyCFrame
existed as a performance optimization for tracing. Since PEP 669 has been implemented, this optimization no longer applies.gh-91051 [https://github.com/python/cpython/issues/91051]: Fix abort / segfault when using all eight type watcher slots, on platforms where
char
is signed by default.gh-106581 [https://github.com/python/cpython/issues/106581]: Fix possible assertion failures and missing instrumentation events when
PYTHONUOPS
or-X uops
is enabled.gh-107526 [https://github.com/python/cpython/issues/107526]: Revert converting
vars
,dir
,next
,getattr
, anditer
to argument clinic.gh-84805 [https://github.com/python/cpython/issues/84805]: Autogenerate signature for
METH_NOARGS
andMETH_O
extension functions.gh-107758 [https://github.com/python/cpython/issues/107758]: Make the
dump_stack()
routine used by thelltrace
feature (low-level interpreter debugging) robust against recursion by ensuring that it never calls a_repr_
method implemented in Python. Also make the similar output for Tier-2 uops appear onstdout
(instead ofstderr
), to match thelltrace
code in ceval.c.gh-107659 [https://github.com/python/cpython/issues/107659]: Add docstrings for
ctypes.pointer()
andctypes.POINTER()
.gh-105848 [https://github.com/python/cpython/issues/105848]: Modify the bytecode so that the actual callable for a
CALL
is at a consistent position on the stack (regardless of whether or not bound-method-calling optimizations are active).gh-107674 [https://github.com/python/cpython/issues/107674]: Fixed performance regression in
sys.settrace
.gh-107724 [https://github.com/python/cpython/issues/107724]: In prerelease versions of 3.12, up to rc1, the sys.monitoring callback function for the
PY_THROW
event was missing the third, exception argument. That is now fixed.gh-84436 [https://github.com/python/cpython/issues/84436]: Skip reference count modifications for many known immortal objects.
gh-107596 [https://github.com/python/cpython/issues/107596]: Specialize subscripting
str
objects byint
indexes.gh-107080 [https://github.com/python/cpython/issues/107080]: Trace refs builds (
--with-trace-refs
) were crashing when used with isolated subinterpreters. The problematic global state has been isolated to each interpreter. Other fixing the crashes, this change does not affect users.gh-107557 [https://github.com/python/cpython/issues/107557]: Generate the cases needed for the barebones tier 2 abstract interpreter for optimization passes in CPython.
gh-106608 [https://github.com/python/cpython/issues/106608]: Make
_PyUOpExecutorObject
variable length.gh-100964 [https://github.com/python/cpython/issues/100964]: Clear generators' exception state after
return
to break reference cycles.gh-107455 [https://github.com/python/cpython/issues/107455]: Improve error messages when converting an incompatible type to
ctypes.c_char_p
,ctypes.c_wchar_p
andctypes.c_void_p
.gh-107263 [https://github.com/python/cpython/issues/107263]: Increase C recursion limit for functions other than the main interpreter from 800 to 1500. This should allow functions like
list._repr_
andjson.dumps
to handle all the inputs that they could prior to 3.12gh-104584 [https://github.com/python/cpython/issues/104584]: Fix an issue which caused incorrect inline caches to be read when running with
PYTHONUOPS
or-X uops
enabled.gh-104432 [https://github.com/python/cpython/issues/104432]: Fix potential unaligned memory access on C APIs involving returned sequences of
char *
pointers within thegrp
andsocket
modules. These were revealed using a-fsaniziter=alignment
build on ARM macOS. Patch by Christopher Chavez.gh-106078 [https://github.com/python/cpython/issues/106078]: Isolate
_decimal
(apply PEP 687 [https://peps.python.org/pep-0687/]). Patch by Charlie Zhao.gh-106898 [https://github.com/python/cpython/issues/106898]: Add the exception as the third argument to
PY_UNIND
callbacks insys.monitoring
. This makes thePY_UNWIND
callback consistent with the other exception handling callbacks.gh-106895 [https://github.com/python/cpython/issues/106895]: Raise a
ValueError
when a monitoring callback function returnsDISABLE
for events that cannot be disabled locally.gh-106897 [https://github.com/python/cpython/issues/106897]: Add a
RERAISE
event tosys.monitoring
, which occurs when an exception is reraise, either explicitly by a plainraise
statement, or implicitly in anexcept
orfinally
block.gh-77377 [https://github.com/python/cpython/issues/77377]: Ensure that multiprocessing synchronization objects created in a fork context are not sent to a different process created in a spawn context. This changes a segfault into an actionable RuntimeError in the parent process.
gh-106931 [https://github.com/python/cpython/issues/106931]: Statically allocated string objects are now interned globally instead of per-interpreter. This fixes a situation where such a string would only be interned in a single interpreter. Normal string objects are unaffected.
gh-104621 [https://github.com/python/cpython/issues/104621]: Unsupported modules now always fail to be imported.
gh-107122 [https://github.com/python/cpython/issues/107122]: Add
dbm.ndbm.ndbm.clear()
todbm.ndbm
. Patch By Donghee Na.gh-107122 [https://github.com/python/cpython/issues/107122]: Add
dbm.gnu.gdbm.clear()
todbm.gnu
. Patch By Donghee Na.gh-107015 [https://github.com/python/cpython/issues/107015]: The ASYNC and AWAIT tokens are removed from the Grammar, which removes the possibility of making
async
andawait
soft keywords when usingfeature_version<7
inast.parse()
.gh-106917 [https://github.com/python/cpython/issues/106917]: Fix classmethod-style
super()
method calls (i.e., where the second argument tosuper()
, or the implied second argument drawn fromself/cls
in the case of zero-arg super, is a type) when the target of the call is not a classmethod.gh-105699 [https://github.com/python/cpython/issues/105699]: Python no longer crashes due an infrequent race when initializing per-interpreter interned strings. The crash would manifest when the interpreter was finalized.
gh-105699 [https://github.com/python/cpython/issues/105699]: Python no longer crashes due to an infrequent race in setting
Py_FileSystemDefaultEncoding
andPy_FileSystemDefaultEncodeErrors
(both deprecated), when simultaneously initializing two isolated subinterpreters. Now they are only set during runtime initialization.gh-106908 [https://github.com/python/cpython/issues/106908]: Fix various hangs, reference leaks, test failures, and tracing/introspection bugs when running with
PYTHONUOPS
or-X uops
enabled.gh-106092 [https://github.com/python/cpython/issues/106092]: Fix a segmentation fault caused by a use-after-free bug in
frame_dealloc
when the trashcan delays the deallocation of aPyFrameObject
.gh-106485 [https://github.com/python/cpython/issues/106485]: Reduce the number of materialized instances dictionaries by dematerializing them when possible.
gh-106719 [https://github.com/python/cpython/issues/106719]: No longer suppress arbitrary errors in the
__annotations__
getter and setter in the type and module types.gh-106723 [https://github.com/python/cpython/issues/106723]: Propagate
frozen_modules
to multiprocessing spawned process interpreters.gh-104909 [https://github.com/python/cpython/issues/104909]: Split
LOAD_ATTR_INSTANCE_VALUE
into microops.gh-104909 [https://github.com/python/cpython/issues/104909]: Split
LOAD_GLOBAL
specializations into microops.gh-106597 [https://github.com/python/cpython/issues/106597]: A new debug structure of offsets has been added to the
_PyRuntimeState
that will help out-of-process debuggers and profilers to obtain the offsets to relevant interpreter structures in a way that is agnostic of how Python was compiled and that doesn't require copying the headers. Patch by Pablo Galindogh-106487 [https://github.com/python/cpython/issues/106487]: Allow the count argument of
str.replace()
to be a keyword. Patch by Hugo van Kemenade.gh-96844 [https://github.com/python/cpython/issues/96844]: Improve error message of
list.remove()
. Patch by Donghee Na.gh-81283 [https://github.com/python/cpython/issues/81283]: Compiler now strips indents from docstrings. It reduces
pyc
file size 5% when the module is heavily documented. This change affects to__doc__
so tools like doctest will be affected.gh-106396 [https://github.com/python/cpython/issues/106396]: When the format specification of an fstring expression is empty, the parser now generates an empty
ast.JoinedStr
node for it instead of an one-elementast.JoinedStr
with an empty stringast.Constant
.gh-100288 [https://github.com/python/cpython/issues/100288]: Specialize
LOAD_ATTR
for non-descriptors on the class. AddsLOAD_ATTR_NONDESCRIPTOR_WITH_VALUES
andLOAD_ATTR_NONDESCRIPTOR_NO_DICT
.gh-106008 [https://github.com/python/cpython/issues/106008]: Fix possible reference leaks when failing to optimize comparisons with
None
in the bytecode compiler.gh-106145 [https://github.com/python/cpython/issues/106145]: Make
end_lineno
andend_col_offset
required ontype_param
ast nodes.gh-106213 [https://github.com/python/cpython/issues/106213]: Changed the way that Emscripten call trampolines work for compatibility with Wasm/JS Promise integration.
gh-106182 [https://github.com/python/cpython/issues/106182]:
sys.getfilesystemencoding()
andsys.getfilesystemencodeerrors
now return interned Unicode object.gh-106210 [https://github.com/python/cpython/issues/106210]: Removed Emscripten import trampoline as it was no longer necessary for Pyodide.
gh-104584 [https://github.com/python/cpython/issues/104584]: Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet — this is infrastructure so we can experiment with optimizing passes. To enable it, pass
-Xuops
or setPYTHONUOPS=1
. To get debug output, setPYTHONUOPSDEBUG=N
whereN
is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose).gh-105775 [https://github.com/python/cpython/issues/105775]:
LOAD_CLOSURE
is now a pseudo-op.gh-105730 [https://github.com/python/cpython/issues/105730]: Allow any callable other than type objects as the condition predicate in
BaseExceptionGroup.split()
andBaseExceptionGroup.subgroup()
.gh-105979 [https://github.com/python/cpython/issues/105979]: Fix crash in
imp.getfrozen_object()
due to improper exception handling.gh-106003 [https://github.com/python/cpython/issues/106003]: Add a new
TO_BOOL
instruction, which performs boolean conversions forPOP_JUMP_IF_TRUE
,POP_JUMP_IF_FALSE
, andUNARY_NOT
(which all expect exactbool
values now). Also, modify the oparg ofCOMPARE_OP
to include an optional "boolean conversion" flag.gh-98931 [https://github.com/python/cpython/issues/98931]: Ensure custom
SyntaxError
error messages are raised for invalid imports with multiple targets. Patch by Pablo Galindogh-105724 [https://github.com/python/cpython/issues/105724]: Improve
assert
error messages by providing exact error range.gh-105908 [https://github.com/python/cpython/issues/105908]: Fixed bug where gh-99111 [https://github.com/python/cpython/issues/99111] breaks future import
barryasFLUFL
in the Python REPL.gh-105840 [https://github.com/python/cpython/issues/105840]: Fix possible crashes when specializing function calls with too many
__defaults__
.gh-105831 [https://github.com/python/cpython/issues/105831]: Fix an fstring bug, where using a debug expression (the
=
sign) that appears in the last line of a file results to the debug buffer that holds the expression text being one character too small.gh-105800 [https://github.com/python/cpython/issues/105800]: Correctly issue
SyntaxWarning
in fstrings if invalid sequences are used. Patch by Pablo Galindogh-105340 [https://github.com/python/cpython/issues/105340]: Include the comprehension iteration variable in
locals()
inside a module-or class-scope comprehension.gh-105331 [https://github.com/python/cpython/issues/105331]: Raise
ValueError
if thedelay
argument toasyncio.sleep()
is a NaN (matchingtime.sleep()
).gh-105587 [https://github.com/python/cpython/issues/105587]: The runtime can't guarantee that immortal objects will not be mutated by Extensions. Thus, this modifies PyStaticObjectCheckRefcnt to warn instead of asserting.
gh-105564 [https://github.com/python/cpython/issues/105564]: Don't include artificil newlines in the
line
attribute of tokens in the APIs of thetokenize
module. Patch by Pablo Galindogh-105549 [https://github.com/python/cpython/issues/105549]: Tokenize separately
NUMBER
andNAME
tokens that are not ambiguous. Patch by Pablo Galindo.gh-105588 [https://github.com/python/cpython/issues/105588]: Fix an issue that could result in crashes when compiling malformed
ast
nodes.gh-100987 [https://github.com/python/cpython/issues/100987]: Allow objects other than code objects as the "executable" in internal frames. In the long term, this can help tools like Cython and PySpy interact more efficiently. In the shorter term, it allows us to perform some optimizations more simply.
gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bugs in the
builtins
module where exceptions could end up being overwritten.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bug in the compiler where an exception could end up being overwritten.
gh-105375 [https://github.com/python/cpython/issues/105375]: Improve error handling in
PyUnicode_BuildEncodingMap()
where an exception could end up being overwritten.gh-105486 [https://github.com/python/cpython/issues/105486]: Change the repr of
ParamSpec
list of args intypes.GenericAlias
.gh-105678 [https://github.com/python/cpython/issues/105678]: Break the
MAKE_FUNCTION
instruction into two parts,MAKE_FUNCTION
which makes the function andSET_FUNCTION_ATTRIBUTE
which sets the attributes on the function. This makes the stack effect ofMAKE_FUNCTION
regular to ease optimization and code generation.gh-105435 [https://github.com/python/cpython/issues/105435]: Fix spurious newline character if file ends on a comment without a newline. Patch by Pablo Galindo
gh-105390 [https://github.com/python/cpython/issues/105390]: Correctly raise
tokenize.TokenError
exceptions instead ofSyntaxError
for tokenize errors such as incomplete input. Patch by Pablo Galindogh-105259 [https://github.com/python/cpython/issues/105259]: Don't include newline character for trailing
NEWLINE
tokens emitted in thetokenize
module. Patch by Pablo Galindogh-104635 [https://github.com/python/cpython/issues/104635]: Eliminate redundant
STORE_FAST
instructions in the compiler. Patch by Donghee Na and Carl Meyer.gh-105324 [https://github.com/python/cpython/issues/105324]: Fix the main function of the
tokenize
module when reading fromsys.stdin
. Patch by Pablo Galindogh-33092 [https://github.com/python/cpython/issues/33092]: Simplify and speed up interpreter for fstrings. Removes
FORMAT_VALUE
opcode. AddCONVERT_VALUE
,FORMAT_SIMPLE
andFORMAT_WITH_SPEC
opcode. Compiler emits more efficient sequence for each format expression.gh-105229 [https://github.com/python/cpython/issues/105229]: Remove remaining two-codeunit superinstructions. All remaining superinstructions only take a single codeunit, simplifying instrumentation and quickening.
gh-105235 [https://github.com/python/cpython/issues/105235]: Prevent out-of-bounds memory access during
mmap.find()
calls.gh-98963 [https://github.com/python/cpython/issues/98963]: Restore the ability for a subclass of
property
to define__slots__
or otherwise be dict-less by ignoring failures to set a docstring on such a class. This behavior had regressed in 3.12beta1. AnAttributeError
where there had not previously been one was disruptive to existing code.gh-104812 [https://github.com/python/cpython/issues/104812]: The "pending call" machinery now works for all interpreters, not just the main interpreter, and runs in all threads, not just the main thread. Some calls are still only done in the main thread, ergo in the main interpreter. This change does not affect signal handling nor the existing public C-API (
Py_AddPendingCall()
), which both still only target the main thread. The new functionality is meant strictly for internal use for now, since consequences of its use are not well understood yet outside some very restricted cases. This change brings the capability in line with the intention when the state was made per-interpreter several years ago.gh-105194 [https://github.com/python/cpython/issues/105194]: Do not escape with backslashes fstring format specifiers. Patch by Pablo Galindo
gh-105229 [https://github.com/python/cpython/issues/105229]: Replace some dynamic superinstructions with single instruction equivalents.
gh-105162 [https://github.com/python/cpython/issues/105162]: Fixed bug in generator.close()/throw() where an inner iterator would be ignored when the outer iterator was instrumented.
gh-105164 [https://github.com/python/cpython/issues/105164]: Ensure annotations are set up correctly if the only annotation in a block is within a
match
block. Patch by Jelle Zijlstra.gh-105148 [https://github.com/python/cpython/issues/105148]: Make
_PyASTOptimizeState
internal to ast_opt.c. MakePyASTOptimize
take two integers instead of a pointer to this struct. This avoids the need to include pycore_compile.h in ast_opt.c.gh-104799 [https://github.com/python/cpython/issues/104799]: Attributes of
ast
nodes that are lists now default to the empty list if omitted. This means that some code that previously raisedTypeError
when the AST node was used will now proceed with the empty list instead. Patch by Jelle Zijlstra.gh-105111 [https://github.com/python/cpython/issues/105111]: Remove the old trashcan macros
Py_TRASHCAN_SAFE_BEGIN
andPy_TRASHCAN_SAFE_END
. They should be replaced by the new macrosPy_TRASHCAN_BEGIN
andPy_TRASHCAN_END
.gh-105035 [https://github.com/python/cpython/issues/105035]: Fix
super()
calls on types with customtp_getattro
implementation (e.g. meta-types.)gh-105017 [https://github.com/python/cpython/issues/105017]: Show CRLF lines in the tokenize string attribute in both NL and NEWLINE tokens. Patch by Marta Gómez.
gh-105013 [https://github.com/python/cpython/issues/105013]: Fix handling of multiline parenthesized lambdas in
inspect.getsource()
. Patch by Pablo Galindogh-105017 [https://github.com/python/cpython/issues/105017]: Do not include an additional final
NL
token when parsing files having CRLF lines. Patch by Marta Gómez.gh-104976 [https://github.com/python/cpython/issues/104976]: Ensure that trailing
DEDENT
tokenize.TokenInfo
objects emitted by thetokenize
module are reported as in Python 3.11. Patch by Pablo Galindogh-104972 [https://github.com/python/cpython/issues/104972]: Ensure that the
line
attribute intokenize.TokenInfo
objects in thetokenize
module are always correct. Patch by Pablo Galindogh-104955 [https://github.com/python/cpython/issues/104955]: Fix signature for the new
__release_buffer__()
slot. Patch by Jelle Zijlstra.gh-104690 [https://github.com/python/cpython/issues/104690]: Starting new threads and process creation through
os.fork()
during interpreter shutdown (such as fromatexit
handlers) is no longer supported. It can lead to race condition between the main Python runtime thread freeing thread states while internalthreading
routines are trying to allocate and use the state of just created threads. Or forked children trying to use the mid-shutdown runtime and thread state in the child process.gh-104879 [https://github.com/python/cpython/issues/104879]: Fix crash when accessing the
__module__
attribute of type aliases defined outside a module. Patch by Jelle Zijlstra.gh-104825 [https://github.com/python/cpython/issues/104825]: Tokens emitted by the
tokenize
module do not include an implicit\n
character in theline
attribute anymore. Patch by Pablo Galindogh-104770 [https://github.com/python/cpython/issues/104770]: If a generator returns a value upon being closed, the value is now returned by
generator.close()
.gh-89091 [https://github.com/python/cpython/issues/89091]: Raise
RuntimeWarning
for unawaited async generator methods likeasend()
,athrow()
andaclose()
. Patch by Kumar Aditya.gh-96663 [https://github.com/python/cpython/issues/96663]: Add a better, more introspectable error message when setting attributes on classes without a
__dict__
and no slot member for the attribute.gh-93627 [https://github.com/python/cpython/issues/93627]: Update the Python pickle module implementation to match the C implementation of the pickle module. For objects setting reduction methods like
__reduce_ex__()
or__reduce__()
toNone
, pickling will result in aTypeError
.gh-101006 [https://github.com/python/cpython/issues/101006]: Improve error handling when read
marshal
data.gh-91095 [https://github.com/python/cpython/issues/91095]: Specializes calls to most Python classes. Specifically, any class that inherits from
object
, or another Python class, and does not override_new_
.
The specialized instruction does the following:
Creates the object (by calling
object._new_
)Pushes a shim frame to the frame stack (to cleanup after
__init__
)Pushes the frame for
__init__
to the frame stack
Speeds up the instantiation of most Python classes.
库
gh-110786 [https://github.com/python/cpython/issues/110786]:
sysconfig
's CLI now ignoresBrokenPipeError
, making it exit normally if its output is being piped and the pipe closes.gh-103480 [https://github.com/python/cpython/issues/103480]: The
sysconfig
module is now a package, instead of a single-file module.gh-110733 [https://github.com/python/cpython/issues/110733]: Microoptimization: Avoid calling
min()
,max()
inBaseEventLoop.runonce()
.gh-94597 [https://github.com/python/cpython/issues/94597]: Added
asyncio.EventLoop
for use with theasyncio.run()
loop_factory kwarg to avoid calling the asyncio policy system.gh-110682 [https://github.com/python/cpython/issues/110682]:
runtime-checkable protocols
used to consider__match_args__
a protocol member in__instancecheck__
if it was present on the protocol. Now, this attribute is ignored if it is present.gh-110488 [https://github.com/python/cpython/issues/110488]: Fix a couple of issues in
pathlib.PurePath.with_name()
: a single dot was incorrectly considered a valid name, and inPureWindowsPath
, a name with an NTFS alternate data stream, likea:b
, was incorrectly considered invalid.gh-110590 [https://github.com/python/cpython/issues/110590]: Fix a bug in
_sre.compile()
whereTypeError
would be overwritten byOverflowError
when the code argument was a list of non-ints.gh-65052 [https://github.com/python/cpython/issues/65052]: Prevent
pdb
from crashing when trying to display undisplayable objectsgh-110519 [https://github.com/python/cpython/issues/110519]: Deprecation warning about non-integer number in
gettext
now always refers to the line in the user code where gettext function or method is used. Previously it could refer to a line ingettext
code.gh-89902 [https://github.com/python/cpython/issues/89902]: Deprecate non-standard format specifier "N" for
decimal.Decimal
. It was not documented and only supported in the C implementation.gh-110378 [https://github.com/python/cpython/issues/110378]:
contextmanager()
andasynccontextmanager()
context managers now close an invalid underlying generator object that yields more then one value.gh-106670 [https://github.com/python/cpython/issues/106670]: In
pdb
, set convenience variable$_exception
for post mortem debugging.gh-110365 [https://github.com/python/cpython/issues/110365]: Fix
termios.tcsetattr()
bug that was overwriting existing errors during parsing integers fromterm
list.gh-109653 [https://github.com/python/cpython/issues/109653]: Slightly improve the import time of several standard-library modules by deferring imports of
warnings
within those modules. Patch by Alex Waygood.gh-110273 [https://github.com/python/cpython/issues/110273]:
dataclasses.replace()
now raises TypeError instead of ValueError if specify keyword argument for a field declared with init=False or miss keyword argument for required InitVar field.gh-110249 [https://github.com/python/cpython/issues/110249]: Add
--inlinecaches
flag todis
command line.gh-109653 [https://github.com/python/cpython/issues/109653]: Fix a Python 3.12 regression in the import time of
random
. Patch by Alex Waygood.gh-110222 [https://github.com/python/cpython/issues/110222]: Add support of struct sequence objects in
copy.replace()
. Patched by Xuehai Pan.gh-109649 [https://github.com/python/cpython/issues/109649]:
multiprocessing
,concurrent.futures
,compileall
: Replaceos.cpu_count()
withos.process_cpu_count()
to select the default number of worker threads and processes. Get the CPU affinity if supported. Patch by Victor Stinner.gh-110150 [https://github.com/python/cpython/issues/110150]: Fix base case handling in statistics.quantiles. Now allows a single data point.
gh-110036 [https://github.com/python/cpython/issues/110036]: On Windows, multiprocessing
Popen.terminate()
now catchesPermissionError
and get the process exit code. If the process is still running, raise again thePermissionError
. Otherwise, the process terminated as expected: store its exit code. Patch by Victor Stinner.gh-110038 [https://github.com/python/cpython/issues/110038]: Fixed an issue that caused
KqueueSelector.select()
to not return all the ready events in some cases when a file descriptor is registered for both read and write.gh-110045 [https://github.com/python/cpython/issues/110045]: Update the
symtable
module to support the new scopes introduced by PEP 695 [https://peps.python.org/pep-0695/].gh-88402 [https://github.com/python/cpython/issues/88402]: Add new variables to
sysconfig.getconfigvars()
on Windows:LIBRARY
,LDLIBRARY
,LIBDIR
,SOABI
, andPy_NOGIL
.gh-109631 [https://github.com/python/cpython/issues/109631]:
re
functions such asre.findall()
,re.split()
,re.search()
andre.sub()
which perform short repeated matches can now be interrupted by user.gh-109653 [https://github.com/python/cpython/issues/109653]: Reduce the import time of
email.utils
by around 43%. This results in the import time ofemail.message
falling by around 18%, which in turn reduces the import time ofimportlib.metadata
by around 6%. Patch by Alex Waygood.gh-109818 [https://github.com/python/cpython/issues/109818]: Fix
reprlib.recursive_repr()
not copying__type_params__
from decorated function.gh-109047 [https://github.com/python/cpython/issues/109047]:
concurrent.futures
: The executor manager thread now catches exceptions when adding an item to the call queue. During Python finalization, creating a new thread can now raiseRuntimeError
. Catch the exception and callterminate_broken()
in this case. Patch by Victor Stinner.gh-109782 [https://github.com/python/cpython/issues/109782]: Ensure the signature of
os.path.isdir()
is identical on all platforms. Patch by Amin Alaee.gh-109653 [https://github.com/python/cpython/issues/109653]: Improve import time of
functools
by around 13%. Patch by Alex Waygood.gh-109590 [https://github.com/python/cpython/issues/109590]:
shutil.which()
will prefer files with an extension inPATHEXT
if the given mode includesos.X_OK
on win32. If noPATHEXT
match is found, a file without an extension inPATHEXT
can be returned. This change will haveshutil.which()
act more similarly to previous behavior in Python 3.11.gh-109653 [https://github.com/python/cpython/issues/109653]: Reduce the import time of
enum
by over 50%. Patch by Alex Waygood.gh-109593 [https://github.com/python/cpython/issues/109593]: Avoid deadlocking on a reentrant call to the multiprocessing resource tracker. Such a reentrant call, though unlikely, can happen if a GC pass invokes the finalizer for a multiprocessing object such as SemLock.
gh-109653 [https://github.com/python/cpython/issues/109653]: Reduce the import time of
typing
by around a third. Patch by Alex Waygood.gh-109649 [https://github.com/python/cpython/issues/109649]: Add
os.process_cpu_count()
function to get the number of logical CPUs usable by the calling thread of the current process. Patch by Victor Stinner.gh-74481 [https://github.com/python/cpython/issues/74481]: Add
set_error_mode
related constants inmsvcrt
module in Python debug build.gh-109613 [https://github.com/python/cpython/issues/109613]: Fix
os.stat()
andos.DirEntry.stat()
: check for exceptions. Previously, on Python built in debug mode, these functions could trigger a fatal Python error (and abort the process) when a function succeeded with an exception set. Patch by Victor Stinner.gh-109599 [https://github.com/python/cpython/issues/109599]: Expose the type of PyCapsule objects as
types.CapsuleType
.gh-109109 [https://github.com/python/cpython/issues/109109]: You can now get the raw TLS certificate chains from TLS connections via
ssl.SSLSocket.get_verified_chain()
andssl.SSLSocket.get_unverified_chain()
methods.
Contributed by Mateusz Nowak.
gh-109559 [https://github.com/python/cpython/issues/109559]: Update
unicodedata
database to Unicode 15.1.0.gh-109543 [https://github.com/python/cpython/issues/109543]: Remove unnecessary
hasattr()
check duringtyping.TypedDict
creation.gh-109495 [https://github.com/python/cpython/issues/109495]: Remove unnecessary extra
__slots__
indatetime
's pure python implementation to reduce memory size, as they are defined in the superclass. Patch by James Hilton-Balfegh-109461 [https://github.com/python/cpython/issues/109461]:
logging
: Use a context manager for lock acquisition.gh-109096 [https://github.com/python/cpython/issues/109096]:
http.server.CGIHTTPRequestHandler
has been deprecated for removal in 3.15. Its design is old and the web world has long since moved beyond CGI.gh-109409 [https://github.com/python/cpython/issues/109409]: Fix error when it was possible to inherit a frozen dataclass from multiple parents some of which were possibly not frozen.
gh-109375 [https://github.com/python/cpython/issues/109375]: The
pdb
alias
command now prevents registering aliases without arguments.gh-109319 [https://github.com/python/cpython/issues/109319]: Deprecate the
dis.HAVE_ARGUMENT
field in favour ofdis.hasarg
.gh-107219 [https://github.com/python/cpython/issues/107219]: Fix a race condition in
concurrent.futures
. When a process in the process pool was terminated abruptly (while the future was running or pending), close the connection write end. If the call queue is blocked on sending bytes to a worker process, closing the connection write end interrupts the send, so the queue can be closed. Patch by Victor Stinner.gh-66143 [https://github.com/python/cpython/issues/66143]: The
codecs.CodecInfo
object has been made copyable and pickleable. Patched by Robert Lehmann and Furkan Onder.gh-109187 [https://github.com/python/cpython/issues/109187]:
pathlib.Path.resolve()
now treats symlink loops like other errors: in strict mode,OSError
is raised, and in non-strict mode, no exception is raised.gh-50644 [https://github.com/python/cpython/issues/50644]: Attempts to pickle or create a shallow or deep copy of
codecs
streams now raise a TypeError. Previously, copying failed with a RecursionError, while pickling produced wrong results that eventually caused unpickling to fail with a RecursionError.gh-109174 [https://github.com/python/cpython/issues/109174]: Add support of
types.SimpleNamespace
incopy.replace()
.gh-109164 [https://github.com/python/cpython/issues/109164]:
pdb
: Replacegetopt
withargparse
for parsing command line arguments.gh-109151 [https://github.com/python/cpython/issues/109151]: Enable
readline
editing features in the sqlite3 commandline interface (python -m sqlite3
).gh-108987 [https://github.com/python/cpython/issues/108987]: Fix
thread.startnew_thread()
race condition. If a thread is created during Python finalization, the newly spawned thread now exits immediately instead of trying to access freed memory and lead to a crash. Patch by Victor Stinner.gh-108682 [https://github.com/python/cpython/issues/108682]: Enum: require
names=()
ortype=…
to create an empty enum using the functional syntax.gh-109033 [https://github.com/python/cpython/issues/109033]: Exceptions raised by os.utime builtin function now include the related filename
gh-108843 [https://github.com/python/cpython/issues/108843]: Fix an issue in
ast.unparse()
when unparsing fstrings containing many quote types.gh-108469 [https://github.com/python/cpython/issues/108469]:
ast.unparse()
now supports new fstring syntax introduced in Python 3.12. Note that the fstring quotes are reselected for simplicity under the new syntax. (Patch by Steven Sun)gh-108751 [https://github.com/python/cpython/issues/108751]: Add
copy.replace()
function which allows to create a modified copy of an object. It supports named tuples, dataclasses, and many other objects.gh-108682 [https://github.com/python/cpython/issues/108682]: Enum: raise
TypeError
ifsuper()._new_()
is called from a custom_new_
.gh-108278 [https://github.com/python/cpython/issues/108278]: Deprecate passing the callback callable by keyword for the following
sqlite3.Connection
APIs:
受影响的形参将在 Python 3.15 中成为仅限位置形参。
Patch by Erlend E. Aasland.
gh-105829 [https://github.com/python/cpython/issues/105829]: Fix concurrent.futures.ProcessPoolExecutor deadlock
gh-108295 [https://github.com/python/cpython/issues/108295]: Fix crashes related to use of weakrefs on
typing.TypeVar
.gh-108463 [https://github.com/python/cpython/issues/108463]: Make expressions/statements work as expected in pdb
gh-108277 [https://github.com/python/cpython/issues/108277]: Add
os.timerfd_create()
,os.timerfd_settime()
,os.timerfd_gettime()
,os.timerfd_settime_ns()
, andos.timerfd_gettime_ns()
to provide a low level interface for Linux's timer notification file descriptor.gh-107811 [https://github.com/python/cpython/issues/107811]:
tarfile
: extraction of members with overly large UID or GID (e.g. on an OS with 32-bitid_t
) now fails in the same way as failing to set the ID.gh-64662 [https://github.com/python/cpython/issues/64662]: Fix support for virtual tables in
sqlite3.Connection.iterdump()
. Patch by Aviv Palivoda.gh-108111 [https://github.com/python/cpython/issues/108111]: Fix a regression introduced in gh-101251 [https://github.com/python/cpython/issues/101251] for 3.12, resulting in an incorrect offset calculation in
gzip.GzipFile.seek()
.gh-108294 [https://github.com/python/cpython/issues/108294]:
time.sleep()
now raises an auditing event.gh-108278 [https://github.com/python/cpython/issues/108278]: Deprecate passing name, number of arguments, and the callable as keyword arguments, for the following
sqlite3.Connection
APIs:
受影响的形参将在 Python 3.15 中成为仅限位置形参。
Patch by Erlend E. Aasland.
gh-108322 [https://github.com/python/cpython/issues/108322]: Speedup NormalDist.samples() by using the inverse CDF method instead of calling random.gauss().
gh-83417 [https://github.com/python/cpython/issues/83417]: Add the ability for venv to create a
.gitignore
file which causes the created environment to be ignored by Git. It is on by default when venv is called via its CLI.gh-105736 [https://github.com/python/cpython/issues/105736]: Harmonized the pure Python version of
OrderedDict
with the C version. Now, both versions set up their internal state in_new_
. Formerly, the pure Python version did the set up in__init__
.gh-108083 [https://github.com/python/cpython/issues/108083]: Fix bugs in the constructor of
sqlite3.Connection
andsqlite3.Connection.close()
where exceptions could be leaked. Patch by Erlend E. Aasland.gh-107932 [https://github.com/python/cpython/issues/107932]: Fix
dis
module to properly report and display bytecode that do not have source lines.gh-105539 [https://github.com/python/cpython/issues/105539]:
sqlite3
now emits anResourceWarning
if asqlite3.Connection
object is notclosed
explicitly. Patch by Erlend E. Aasland.gh-107995 [https://github.com/python/cpython/issues/107995]: The
__module__
attribute on instances offunctools.cached_property
is now set to the name of the module in which the cached_property is defined, rather than "functools". This means that doctests incached_property
docstrings are now properly collected by thedoctest
module. Patch by Tyler Smart.gh-107963 [https://github.com/python/cpython/issues/107963]: Fix
multiprocessing.set_forkserver_preload()
to check the given list of modules names. Patch by Donghee Na.gh-106242 [https://github.com/python/cpython/issues/106242]: Fixes
os.path.normpath()
to handle embedded null characters without truncating the path.gh-81555 [https://github.com/python/cpython/issues/81555]:
xml.dom.minidom
now only quotes"
in attributes.gh-50002 [https://github.com/python/cpython/issues/50002]:
xml.dom.minidom
now preserves whitespaces in attributes.gh-93057 [https://github.com/python/cpython/issues/93057]: Passing more than one positional argument to
sqlite3.connect()
and thesqlite3.Connection
constructor is deprecated. The remaining parameters will become keyword-only in Python 3.15. Patch by Erlend E. Aasland.gh-76913 [https://github.com/python/cpython/issues/76913]: Add merge_extra parameter/feature to
logging.LoggerAdapter
gh-107913 [https://github.com/python/cpython/issues/107913]: Fix possible losses of
errno
andwinerror
values inOSError
exceptions if they were cleared or modified by the cleanup code before creating the exception object.gh-107845 [https://github.com/python/cpython/issues/107845]:
tarfile.data_filter()
now takes the location of symlinks into account when determining their target, so it will no longer reject some valid tarballs withLinkOutsideDestinationError
.gh-107812 [https://github.com/python/cpython/issues/107812]: Extend socket's netlink support to the FreeBSD platform.
gh-107805 [https://github.com/python/cpython/issues/107805]: Fix signatures of module-level generated functions in
turtle
.gh-107782 [https://github.com/python/cpython/issues/107782]:
pydoc
is now able to show signatures which are not representable in Python, e.g. forgetattr
anddict.pop
.gh-56166 [https://github.com/python/cpython/issues/56166]: Deprecate passing optional arguments maxsplit, count and flags in module-level functions
re.split()
,re.sub()
andre.subn()
as positional. They should only be passed by keyword.gh-107710 [https://github.com/python/cpython/issues/107710]: Speed up
logging.getHandlerNames()
.gh-107715 [https://github.com/python/cpython/issues/107715]: Fix
doctest.DocTestFinder.find()
in presence of class names with special characters. Patch by Gertjan van Zwieten.gh-100814 [https://github.com/python/cpython/issues/100814]: Passing a callable object as an option value to a Tkinter image now raises the expected TclError instead of an AttributeError.
gh-72684 [https://github.com/python/cpython/issues/72684]: Add
tkinter
widget methods:tk_busy_hold()
,tk_busy_configure()
,tk_busy_cget()
,tk_busy_forget()
,tk_busy_current()
, andtk_busy_status()
.gh-106684 [https://github.com/python/cpython/issues/106684]: Raise
ResourceWarning
whenasyncio.StreamWriter
is not closed leading to memory leaks. Patch by Kumar Aditya.gh-107465 [https://github.com/python/cpython/issues/107465]: Add
pathlib.Path.from_uri()
classmethod.gh-107077 [https://github.com/python/cpython/issues/107077]: Seems that in some conditions, OpenSSL will return
SSL_ERROR_SYSCALL
instead ofSSL_ERROR_SSL
when a certification verification has failed, but the error parameters will still containERR_LIB_SSL
andSSL_R_CERTIFICATE_VERIFY_FAILED
. We are now detecting this situation and raising the appropriatessl.SSLCertVerificationError
. Patch by Pablo Galindogh-107576 [https://github.com/python/cpython/issues/107576]: Fix
types.get_original_bases()
to only return__orig_bases__
if it is present oncls
directly. Patch by James Hilton-Balfe.gh-105481 [https://github.com/python/cpython/issues/105481]: Remove
opcode.is_pseudo
,opcode.MIN_PSEUDO_OPCODE
andopcode.MAX_PSEUDO_OPCODE
, which were added in 3.12, were never documented and were not intended to be used externally.gh-105481 [https://github.com/python/cpython/issues/105481]:
opcode.ENABLE_SPECIALIZATION
(which was added in 3.12 but never documented or intended for external usage) is moved toopcode.ENABLESPECIALIZATION
where tests can access it.gh-107396 [https://github.com/python/cpython/issues/107396]: tarfiles; Fixed use before assignment of self.exception for gzip decompression
gh-107409 [https://github.com/python/cpython/issues/107409]: Set
__wrapped__
attribute inreprlib.recursive_repr()
.gh-107406 [https://github.com/python/cpython/issues/107406]: Implement new
_repr_()
method forstruct.Struct
. Now it returnsStruct(
.) gh-107369 [https://github.com/python/cpython/issues/107369]: Optimize
textwrap.indent()
. It is ~30% faster for large input. Patch by Inada Naoki.gh-78722 [https://github.com/python/cpython/issues/78722]: Fix issue where
pathlib.Path.iterdir()
did not raiseOSError
until iterated.gh-105578 [https://github.com/python/cpython/issues/105578]: Deprecate
typing.AnyStr
in favor of the new Type Parameter syntax. See PEP 695.gh-62519 [https://github.com/python/cpython/issues/62519]: Make
gettext.pgettext()
search plural definitions when translation is not found.gh-107089 [https://github.com/python/cpython/issues/107089]: Shelves opened with
shelve.open()
have a much fasterclear()
method. Patch by James Cave.gh-82500 [https://github.com/python/cpython/issues/82500]: Fix overflow on 32-bit systems with
asyncio
os.sendfile()
implementation.gh-83006 [https://github.com/python/cpython/issues/83006]: Document behavior of
shutil.disk_usage()
for non-mounted filesystems on Unix.gh-65495 [https://github.com/python/cpython/issues/65495]: Use lowercase
mail from
andrcpt to
insmptlib.SMTP
.gh-106186 [https://github.com/python/cpython/issues/106186]: Do not report
MultipartInvariantViolationDefect
defect when theemail.parser.Parser
class is used to parse emails withheadersonly=True
.gh-105002 [https://github.com/python/cpython/issues/105002]: Fix invalid result from
PurePath.relative_to()
method when attempting to walk a "..
" segment in other with walk_up enabled. AValueError
exception is now raised in this case.gh-106739 [https://github.com/python/cpython/issues/106739]: Add the
rtype_cache
to the warning message (as an addition to the type of leaked objects and the number of leaked objects already included in the message) to make debugging leaked objects easier when the multiprocessing resource tracker process finds leaked objects at shutdown. This helps more quickly identify what was leaked and/or why the leaked object was not properly cleaned up.gh-106751 [https://github.com/python/cpython/issues/106751]: Optimize
SelectSelector.select()
for many iteration case. Patch By Donghee Na.gh-106751 [https://github.com/python/cpython/issues/106751]: Optimize
_PollLikeSelector.select()
for many iteration case.gh-106751 [https://github.com/python/cpython/issues/106751]: Optimize
KqueueSelector.select()
for many iteration case. Patch By Donghee Na.gh-106831 [https://github.com/python/cpython/issues/106831]: Fix potential missing
NULL
check ofd2i_SSL_SESSION
result in_ssl.c
.gh-105481 [https://github.com/python/cpython/issues/105481]: The various opcode lists in the
dis
module are now generated from bytecodes.c instead of explicitly constructed in opcode.py.gh-106727 [https://github.com/python/cpython/issues/106727]: Make
inspect.getsource()
smarter for class for same name definitionsgh-106789 [https://github.com/python/cpython/issues/106789]: Remove import of
pprint
fromsysconfig
.gh-105726 [https://github.com/python/cpython/issues/105726]: Added
__slots__
tocontextlib.AbstractContextManager
andcontextlib.AbstractAsyncContextManager
so that child classes can use__slots__
.gh-106774 [https://github.com/python/cpython/issues/106774]: Update the bundled copy of pip to version 23.2.1.
gh-106751 [https://github.com/python/cpython/issues/106751]:
selectors
: OptimizeEpollSelector.select()
code by moving some code outside of the loop.gh-106752 [https://github.com/python/cpython/issues/106752]: Fixed several bugs in zipfile.Path, including: in
zipfile.Path.match()
, Windows separators are no longer honored (and never were meant to be); Fixedname
/suffix
/suffixes
/stem
operations when no filename is present and the Path is not at the root of the zipfile; Reworked glob for performance and more correct matching behavior.gh-105293 [https://github.com/python/cpython/issues/105293]: Remove call to
SSL_CTXsetsession_id_context
during client side context creation in thessl
module.gh-106734 [https://github.com/python/cpython/issues/106734]: Disable tab completion in multiline mode of
pdb
gh-105481 [https://github.com/python/cpython/issues/105481]: Expose opcode metadata through
_opcode
.gh-106670 [https://github.com/python/cpython/issues/106670]: Add the new
exceptions
command to the Pdb debugger. It makes it possible to move between chained exceptions when using post mortem debugging.gh-106602 [https://github.com/python/cpython/issues/106602]: Add copy and deepcopy in
enum
gh-106664 [https://github.com/python/cpython/issues/106664]:
selectors
: Add_SelectorMapping.get()
method and optimize_SelectorMapping.__getitem__()
.gh-106628 [https://github.com/python/cpython/issues/106628]: Speed up parsing of emails by about 20% by not compiling a new regular expression for every single email.
gh-89427 [https://github.com/python/cpython/issues/89427]: Set the environment variable
VIRTUAL_ENV_PROMPT
atvenv
activation, even whenVIRTUAL_ENV_DISABLE_PROMPT
is set.gh-106530 [https://github.com/python/cpython/issues/106530]: Revert a change to
colorsys.rgb_to_hls()
that caused division by zero for certain almost-white inputs. Patch by Terry Jan Reedy.gh-106584 [https://github.com/python/cpython/issues/106584]: Fix exit code for
unittest
if all tests are skipped. Patch by Egor Eliseev.gh-106566 [https://github.com/python/cpython/issues/106566]: Optimize
(?!)
(pattern which always fails) in regular expressions.gh-106554 [https://github.com/python/cpython/issues/106554]:
selectors
: Reduce Selector overhead by using adict.get()
to lookup file descriptors.gh-106558 [https://github.com/python/cpython/issues/106558]: Remove ref cycle in callers of
convert_to_error()
by deletingresult
from scope in afinally
block.gh-100502 [https://github.com/python/cpython/issues/100502]: Add
pathlib.PurePath.pathmod
class attribute that stores the implementation ofos.path
used for low-level path operations: eitherposixpath
orntpath
.gh-106527 [https://github.com/python/cpython/issues/106527]: Reduce overhead to add and remove
asyncio
readers and writers.gh-106524 [https://github.com/python/cpython/issues/106524]: Fix crash in
_sre.template()
with templates containing invalid group indices.gh-106531 [https://github.com/python/cpython/issues/106531]: Removed
_legacy
and the names it provided fromimportlib.resources
:Resource
,contents
,is_resource
,open_binary
,open_text
,path
,read_binary
, andread_text
.gh-106052 [https://github.com/python/cpython/issues/106052]:
re
module: fix the matching of possessive quantifiers in the case of a subpattern containing backtracking.gh-106510 [https://github.com/python/cpython/issues/106510]: Improve debug output for atomic groups in regular expressions.
gh-106503 [https://github.com/python/cpython/issues/106503]: Fix ref cycle in
asyncio._SelectorSocketTransport
by removingwriteready
inclose
.gh-105497 [https://github.com/python/cpython/issues/105497]: Fix flag mask inversion when unnamed flags exist.
gh-90876 [https://github.com/python/cpython/issues/90876]: Prevent
multiprocessing.spawn
from failing to import in environments wheresys.executable
isNone
. This regressed in 3.11 with the addition of support for pathlike objects in multiprocessing.gh-106403 [https://github.com/python/cpython/issues/106403]: Instances of
typing.TypeVar
,typing.ParamSpec
,typing.ParamSpecArgs
,typing.ParamSpecKwargs
, andtyping.TypeVarTuple
once again support weak references, fixing a regression introduced in Python 3.12.0 beta 1. Patch by Jelle Zijlstra.gh-89812 [https://github.com/python/cpython/issues/89812]: Add private
pathlib._PathBase
class, which provides experimental support for virtual filesystems, and may be made public in a future version of Python.gh-106292 [https://github.com/python/cpython/issues/106292]: Check for an instance-dict cached value in the
_get_()
method offunctools.cached_property()
. This better matches the pre-3.12 behavior and improves compatibility for users subclassingfunctools.cached_property()
and adding a_set_()
method.gh-106350 [https://github.com/python/cpython/issues/106350]: Detect possible memory allocation failure in the libtommath function
mp_init()
used by the_tkinter
module.gh-106330 [https://github.com/python/cpython/issues/106330]: Fix incorrect matching of empty paths in
pathlib.PurePath.match()
. This bug was introduced in Python 3.12.0 beta 1.gh-106309 [https://github.com/python/cpython/issues/106309]: Deprecate
typing.no_type_check_decorator()
. No major type checker ever added support for this decorator. Patch by Alex Waygood.gh-102541 [https://github.com/python/cpython/issues/102541]: Make
pydoc.doc()
catch bad moduleImportError
when output stream is notNone
.gh-106263 [https://github.com/python/cpython/issues/106263]: Fix crash when calling
repr
with a manually constructed SignalDict object. Patch by Charlie Zhao.gh-106236 [https://github.com/python/cpython/issues/106236]: Replace
assert
statements withraise RuntimeError
inthreading
, so that_DummyThread
cannot be joined even with-OO
.gh-106238 [https://github.com/python/cpython/issues/106238]: Fix rare concurrency bug in lock acquisition by the logging package.
gh-106152 [https://github.com/python/cpython/issues/106152]: Added PY_THROW event hook for
cProfile
for generatorsgh-106075 [https://github.com/python/cpython/issues/106075]: Added
asyncio.taskgroups.__all__
toasyncio.__all__
for export in star imports.gh-104527 [https://github.com/python/cpython/issues/104527]: Zipapp will now skip over appending an archive to itself.
gh-106046 [https://github.com/python/cpython/issues/106046]: Improve the error message from
os.fspath()
if called on an object where__fspath__
is set toNone
. Patch by Alex Waygood.gh-105987 [https://github.com/python/cpython/issues/105987]: Fix crash due to improper reference counting in
asyncio
eager task factory internal routines.gh-105974 [https://github.com/python/cpython/issues/105974]: Fix bug where a
typing.Protocol
class that had one or more non-callable members would raiseTypeError
whenissubclass()
was called against it, even if it defined a custom__subclasshook__
method. The behaviour in Python 3.11 and lower — which has now been restored — was not to raiseTypeError
in these situations if a custom__subclasshook__
method was defined. Patch by Alex Waygood.gh-96145 [https://github.com/python/cpython/issues/96145]: Reverted addition of
json.AttrDict
.gh-89812 [https://github.com/python/cpython/issues/89812]: Add
pathlib.UnsupportedOperation
, which is raised instead ofNotImplementedError
when a path operation isn't supported.gh-105808 [https://github.com/python/cpython/issues/105808]: Fix a regression introduced in gh-101251 [https://github.com/python/cpython/issues/101251] for 3.12, causing
gzip.GzipFile.flush()
to not flush the compressor (nor pass along thezip_mode
argument).gh-105481 [https://github.com/python/cpython/issues/105481]:
stack_effect()
no longer raises an exception if anoparg
is provided for anopcode
that doesn't use its arg, or when it is not provided for anopcode
that does use it. In the latter case, the stack effect is returned foroparg=0
.gh-104799 [https://github.com/python/cpython/issues/104799]: Enable
ast.unparse()
to unparse function and class definitions created without the newtype_params
field from PEP 695 [https://peps.python.org/pep-0695/]. Patch by Jelle Zijlstra.gh-105793 [https://github.com/python/cpython/issues/105793]: Add follow_symlinks keyword-only argument to
pathlib.Path.is_dir()
andis_file()
, defaulting toTrue
.gh-105570 [https://github.com/python/cpython/issues/105570]: Deprecate two methods of creating
typing.TypedDict
classes with 0 fields using the functional syntax:TD = TypedDict("TD")
andTD = TypedDict("TD", None)
. Both will be disallowed in Python 3.15. To create aTypedDict
class with 0 fields, either useclass TD(TypedDict): pass
orTD = TypedDict("TD", {})
.gh-105745 [https://github.com/python/cpython/issues/105745]: Fix
webbrowser.Konqueror.open
method.gh-105733 [https://github.com/python/cpython/issues/105733]:
ctypes
: Deprecate undocumentedctypes.SetPointerType()
andctypes.ARRAY()
functions. Patch by Victor Stinner.gh-105687 [https://github.com/python/cpython/issues/105687]: Remove deprecated
re.template
,re.T
,re.TEMPLATE
,sre_constans.SRE_FLAG_TEMPLATE
.gh-105684 [https://github.com/python/cpython/issues/105684]: Supporting
asyncio.Task.set_name()
is now mandatory for third party task implementations. The undocumentedsettask_name()
function (deprecated since 3.8) has been removed. Patch by Kumar Aditya.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix a bug in
UnpicklerSetInputStream()
where an exception could end up being overwritten in case of failure.gh-105626 [https://github.com/python/cpython/issues/105626]: Change the default return value of
http.client.HTTPConnection.get_proxy_response_headers()
to beNone
and not{}
.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bugs in
sys
where exceptions could end up being overwritten because of deferred error handling.gh-105605 [https://github.com/python/cpython/issues/105605]: Harden
pyexpat
error handling during module initialisation to prevent exceptions from possibly being overwritten, and objects from being dereferenced twice.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bug in
decimal
where an exception could end up being overwritten.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bugs in
_datetime
where exceptions could be overwritten in case of module initialisation failure.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bugs in
_ssl
initialisation which could lead to leaked references and overwritten exceptions.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix a bug in
array.array
where an exception could end up being overwritten.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bugs in
_ctypes
where exceptions could end up being overwritten.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix a bug in the
posix
module where an exception could be overwritten.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bugs in
_elementtree
where exceptions could be overwritten.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bugs in
zoneinfo
where exceptions could be overwritten.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bugs in
errno
where exceptions could be overwritten.gh-105566 [https://github.com/python/cpython/issues/105566]: Deprecate creating a
typing.NamedTuple
class using keyword arguments to denote the fields (NT = NamedTuple("NT", x=int, y=str)
). This will be disallowed in Python 3.15. Use the class-based syntax or the functional syntax instead.
Two methods of creating NamedTuple
classes with 0 fields using the functional syntax are also deprecated, and will be disallowed in Python 3.15: NT = NamedTuple("NT")
and NT = NamedTuple("NT", None)
. To create a NamedTuple
class with 0 fields, either use class
NT(NamedTuple): pass
or NT = NamedTuple("NT", [])
.
gh-105545 [https://github.com/python/cpython/issues/105545]: Remove deprecated in 3.11
webbrowser.MacOSXOSAScript._name
attribute.gh-105497 [https://github.com/python/cpython/issues/105497]: Fix flag inversion when alias/mask members exist.
gh-105509 [https://github.com/python/cpython/issues/105509]:
typing.Annotated
is now implemented as an instance oftyping._SpecialForm
rather than a class. This should have no user-facing impact for users of thetyping
module public API.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix bugs in
pickle
where exceptions could be overwritten.gh-70303 [https://github.com/python/cpython/issues/70303]: Emit
FutureWarning
frompathlib.Path.glob()
andrglob()
if the given pattern ends with "**
". In a future Python release, patterns with this ending will match both files and directories. Add a trailing slash to only match directories.gh-105375 [https://github.com/python/cpython/issues/105375]: Fix a bug in
sqlite3
where an exception could be overwritten in thecollation
callback.gh-105382 [https://github.com/python/cpython/issues/105382]: Remove cafile, capath and cadefault parameters of the
urllib.request.urlopen()
function, deprecated in Python 3.6. Patch by Victor Stinner.gh-105376 [https://github.com/python/cpython/issues/105376]:
logging
: Remove undocumented and untestedLogger.warn()
andLoggerAdapter.warn()
methods andlogging.warn()
function. Deprecated since Python 3.3, they were aliases to thelogging.Logger.warning()
method,logging.LoggerAdapter.warning()
method andlogging.warning()
function. Patch by Victor Stinner.gh-105332 [https://github.com/python/cpython/issues/105332]: Revert pickling method from by-name back to by-value.
gh-104554 [https://github.com/python/cpython/issues/104554]: Add RTSPS scheme support in urllib.parse
gh-105292 [https://github.com/python/cpython/issues/105292]: Add option to
traceback.format_exception_only()
to recurse into the nested exception of aBaseExceptionGroup
.gh-105280 [https://github.com/python/cpython/issues/105280]: Fix bug where
isinstance([], collections.abc.Mapping)
could evaluate toTrue
if garbage collection happened at the wrong time. The bug was caused by changes to the implementation oftyping.Protocol
in Python 3.12.gh-80480 [https://github.com/python/cpython/issues/80480]:
array
: Add'w'
typecode that representsPy_UCS4
.gh-105239 [https://github.com/python/cpython/issues/105239]: Fix longstanding bug where
issubclass(object, typing.Protocol)
would evaluate toTrue
in some edge cases. Patch by Alex Waygood.gh-104310 [https://github.com/python/cpython/issues/104310]: In the beta 1 release we added a utility function for extension module authors, to use when testing their module for support in multiple interpreters or under a per-interpreter GIL. The name of that function has changed from
allowing_all_extensions
toincompatibleextension_module_restrictions
. The default for the "disable_check" argument has change fromTrue
toFalse
, to better match the new function name.gh-105080 [https://github.com/python/cpython/issues/105080]: Fixed inconsistent signature on derived classes for
inspect.signature()
gh-105144 [https://github.com/python/cpython/issues/105144]: Fix a recent regression in the
typing
module. The regression meant that doingclass Foo(X, typing.Protocol)
, whereX
was a class that hadabc.ABCMeta
as its metaclass, would then cause subsequentisinstance(1, X)
calls to erroneously raiseTypeError
. Patch by Alex Waygood.gh-62948 [https://github.com/python/cpython/issues/62948]: The
io.IOBase
finalizer now logs theclose()
method errors withsys.unraisablehook
. Previously, errors were ignored silently by default, and only logged in Python Development Mode or on Python built on debug mode. Patch by Victor Stinner.gh-105096 [https://github.com/python/cpython/issues/105096]:
wave
: Deprecate thegetmark()
,setmark()
andgetmarkers()
methods of thewave.Wave_read
andwave.Wave_write
classes. They will be removed in Python 3.15. Patch by Victor Stinner.gh-104992 [https://github.com/python/cpython/issues/104992]: Remove the untested and undocumented
unittest.TestProgram.usageExit()
method, deprecated in Python 3.11. Patch by Hugo van Kemenade.gh-104996 [https://github.com/python/cpython/issues/104996]: Improve performance of
pathlib.PurePath
initialisation by deferring joining of paths when multiple arguments are given.gh-101588 [https://github.com/python/cpython/issues/101588]: Deprecate undocumented copy/deepcopy/pickle support for itertools.
gh-103631 [https://github.com/python/cpython/issues/103631]: Fix
pathlib.PurePosixPath(pathlib.PureWindowsPath(…))
not converting path separators to restore 3.11 compatible behavior.gh-104947 [https://github.com/python/cpython/issues/104947]: Make comparisons between
pathlib.PureWindowsPath
objects consistent across Windows and Posix to match 3.11 behavior.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
audioop
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
aifc
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
uu
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104935 [https://github.com/python/cpython/issues/104935]: Fix bugs with the interaction between
typing.runtime_checkable()
andtyping.Generic
that were introduced by the PEP 695 [https://peps.python.org/pep-0695/] implementation. Patch by Jelle Zijlstra.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
crypt
module and its private_crypt
extension, deprecated in Python 3.11. Patch by Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
nis
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104898 [https://github.com/python/cpython/issues/104898]: Add missing
__slots__
toos.PathLike
.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
xdrlib
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
nntplib
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104886 [https://github.com/python/cpython/issues/104886]: Remove the undocumented
configparser.LegacyInterpolation
class, deprecated in the docstring since Python 3.2, and with a deprecation warning since Python 3.11. Patch by Hugo van Kemenade.gh-104786 [https://github.com/python/cpython/issues/104786]: Remove kwargs-based
typing.TypedDict
creationgh-104876 [https://github.com/python/cpython/issues/104876]: Remove the
turtle.RawTurtle.settiltangle()
method, deprecated in docs since Python 3.1 and with a deprecation warning since Python 3.11. Patch by Hugo van Kemenade.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Removed the
msilib
package, deprecated in Python 3.11.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
spwd
module, deprecated in Python 3.11: the python-pam [https://pypi.org/project/python-pam/] project can be used instead. Patch by Victor Stinner.gh-75552 [https://github.com/python/cpython/issues/75552]: Removed the
tkinter.tix
module, deprecated since Python 3.6.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
chunk
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
mailcap
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
sunau
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104780 [https://github.com/python/cpython/issues/104780]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
ossaudiodev
module, deprecated in Python 3.11. Patch Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
pipes
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104873 [https://github.com/python/cpython/issues/104873]: Add
typing.get_protocol_members()
to return the set of members defining atyping.Protocol
. Addtyping.is_protocol()
to check whether a class is atyping.Protocol
. Patch by Jelle Zijlstra.gh-104874 [https://github.com/python/cpython/issues/104874]: Document the
__name__
and__supertype__
attributes oftyping.NewType
. Patch by Jelle Zijlstra.gh-104835 [https://github.com/python/cpython/issues/104835]: Removed the following
unittest
functions, deprecated in Python 3.11:unittest.findTestCases()
unittest.makeSuite()
unittest.getTestCaseNames()
请改用 TestLoader
方法:
Patch by Hugo van Kemenade.
gh-104804 [https://github.com/python/cpython/issues/104804]: Remove the untested and undocumented
webbrowser
MacOSX
class, deprecated in Python 3.11. Patch by Hugo van Kemenade.gh-83863 [https://github.com/python/cpython/issues/83863]: Support for using
pathlib.Path
objects as context managers has been removed. Before Python 3.9, exiting the context manager marked a path as "closed", which caused some (but not all!) methods to raise when called. Since Python 3.9, using a path as a context manager does nothing.gh-104799 [https://github.com/python/cpython/issues/104799]: Adjust the location of the (see PEP 695 [https://peps.python.org/pep-0695/])
type_params
field onast.ClassDef
,ast.AsyncFunctionDef
, andast.FunctionDef
to better preserve backward compatibility. Patch by Jelle Zijlstragh-104797 [https://github.com/python/cpython/issues/104797]: Allow
typing.Protocol
classes to inherit fromcollections.abc.Buffer
. Patch by Jelle Zijlstra.gh-104783 [https://github.com/python/cpython/issues/104783]: Remove
locale.resetlocale()
function deprecated in Python 3.11. Patch by Victor Stinner.gh-104780 [https://github.com/python/cpython/issues/104780]: Remove the
2to3
program and thelib2to3
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
telnetlib
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
imghdr
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
cgi
andcgitb
modules, deprecated in Python 3.11. Patch by Victor Stinner.gh-104773 [https://github.com/python/cpython/issues/104773]: PEP 594 [https://peps.python.org/pep-0594/]: Remove the
sndhdr
module, deprecated in Python 3.11. Patch by Victor Stinner.gh-104372 [https://github.com/python/cpython/issues/104372]: On Linux where
subprocess
can use thevfork()
syscall for faster spawning, prevent the parent process from blocking other threads by dropping the GIL while it waits for the vfork'ed child processexec()
outcome. This prevents spawning a binary from a slow filesystem from blocking the rest of the application.gh-99108 [https://github.com/python/cpython/issues/99108]: We now release the GIL around builtin
hashlib
computations of reasonable size for the SHA families and MD5 hash functions, matching what our OpenSSL backed hash computations already does.gh-102613 [https://github.com/python/cpython/issues/102613]: Improve performance of
pathlib.Path.glob()
when expanding a pattern with a non-terminal "**
" component by filtering walked paths through a regular expression, rather than callingos.scandir()
more than once on each directory.gh-104399 [https://github.com/python/cpython/issues/104399]: Prepare the
_tkinter
module for building with Tcl 9.0 and future libtommath by replacing usage of deprecated functionsmp_to_unsigned_bin_n()
andmp_unsigned_bin_size()
when necessary.gh-102676 [https://github.com/python/cpython/issues/102676]: Add fields
start_offset
,cache_offset
,end_offset
,baseopname
,baseopcode
,jump_target
andoparg
todis.Instruction
.gh-103558 [https://github.com/python/cpython/issues/103558]: Fixed
parent
argument validation mechanism ofargparse
. Improved test coverage.gh-103464 [https://github.com/python/cpython/issues/103464]: Provide helpful usage messages when parsing incorrect
pdb
commands.gh-103384 [https://github.com/python/cpython/issues/103384]: Generalize the regex pattern
BaseConfigurator.INDEX_PATTERN
to allow spaces and non-alphanumeric characters in keys.gh-103124 [https://github.com/python/cpython/issues/103124]: Added multiline statement support for
pdb
gh-101162 [https://github.com/python/cpython/issues/101162]: Forbid using
builtins.issubclass()
withtypes.GenericAlias
as the first argument.gh-103200 [https://github.com/python/cpython/issues/103200]: Fix cache repopulation semantics of zipimport.invalidate_caches(). The cache is now repopulated upon retrieving files with an invalid cache, not when the cache is invalidated.
gh-100061 [https://github.com/python/cpython/issues/100061]: Fix a bug that causes wrong matches for regular expressions with possessive qualifier.
gh-77609 [https://github.com/python/cpython/issues/77609]: Add follow_symlinks argument to
pathlib.Path.glob()
andrglob()
, defaulting to false.gh-102541 [https://github.com/python/cpython/issues/102541]: Hide traceback in
help()
prompt, when import failed.gh-102120 [https://github.com/python/cpython/issues/102120]: Added a stream mode to
tarfile
that allows for reading archives without caching info about the inner files.gh-102029 [https://github.com/python/cpython/issues/102029]: Deprecate passing any arguments to
threading.RLock()
.gh-88233 [https://github.com/python/cpython/issues/88233]: Refactored
zipfile._strip_extra
to use higher level abstractions for extras instead of a heavy-state loop.gh-102024 [https://github.com/python/cpython/issues/102024]: Reduce calls of
idlesemaphore.release()
inconcurrent.futures.thread._worker()
.gh-73435 [https://github.com/python/cpython/issues/73435]: Add support for recursive wildcards in
pathlib.PurePath.match()
.gh-84867 [https://github.com/python/cpython/issues/84867]:
unittest.TestLoader
no longer loads test cases from exactunittest.TestCase
andunittest.FunctionTestCase
classes.gh-99203 [https://github.com/python/cpython/issues/99203]: Restore following CPython <= 3.10.5 behavior of
shutil.make_archive()
: do not create an empty archive ifroot_dir
is not a directory, and, in that case, raiseFileNotFoundError
orNotADirectoryError
regardless offormat
choice. Beyond the brought-back behavior, the function may now also raise these exceptions indry_run
mode.gh-80480 [https://github.com/python/cpython/issues/80480]: Emit
DeprecationWarning
forarray
's'u'
type code, deprecated in docs since Python 3.3.gh-94924 [https://github.com/python/cpython/issues/94924]:
unittest.mock.create_autospec()
now properly returns coroutine functions compatible withinspect.iscoroutinefunction()
gh-94777 [https://github.com/python/cpython/issues/94777]: Fix hanging
multiprocessing
ProcessPoolExecutor
when a child process crashes while data is being written in the call queue.gh-92871 [https://github.com/python/cpython/issues/92871]: Remove the
typing.io
andtyping.re
namespaces, deprecated since Python 3.8. All items are still available from the maintyping
module.bpo-43633 [https://bugs.python.org/issue?@action=redirect&bpo=43633]: Improve the textual representation of IPv4-mapped IPv6 addresses ( RFC 4291 [https://datatracker.ietf.org/doc/html/rfc4291.html] Sections 2.2, 2.5.5.2) in
ipaddress
. Patch by Oleksandr Pavliuk.bpo-44850 [https://bugs.python.org/issue?@action=redirect&bpo=44850]: Improve performance of
operator.methodcaller()
using the PEP 590 [https://peps.python.org/pep-0590/]vectorcall
convention. Patch by Anthony Lee and Pieter Eendebak.bpo-44185 [https://bugs.python.org/issue?@action=redirect&bpo=44185]:
unittest.mock.mock_open()
will call theclose()
method of the file handle mock when it is exiting from the context manager. Patch by Samet Yaslan.bpo-40988 [https://bugs.python.org/issue?@action=redirect&bpo=40988]: Improve performance of
functools.singledispatchmethod
by caching the generated dispatch wrapper. Optimization suggested by frederico. Patch by @mental32, Alex Waygood and Pieter Eendebak.bpo-41768 [https://bugs.python.org/issue?@action=redirect&bpo=41768]:
unittest.mock
speccing no longer calls class properties. Patch by Melanie Witt.bpo-18319 [https://bugs.python.org/issue?@action=redirect&bpo=18319]: Ensure
gettext(msg)
retrieve translations even if a plural form exists. In other words:gettext(msg) == ngettext(msg, '', 1)
.bpo-17013 [https://bugs.python.org/issue?@action=redirect&bpo=17013]: Add
ThreadingMock
tounittest.mock
that can be used to create Mock objects that can wait until they are called. Patch by Karthikeyan Singaravelan and Mario Corchero.