文档
gh-100616 [https://github.com/python/cpython/issues/100616]: Document existing
attr
parameter tocurses.window.vline()
function incurses
.gh-100472 [https://github.com/python/cpython/issues/100472]: Remove claim in documentation that the
stripdir
,prependdir
andlimit_sl_dest
parameters ofcompileall.compile_dir()
andcompileall.compile_file()
could bebytes
.bpo-25377 [https://bugs.python.org/issue?@action=redirect&bpo=25377]: Clarify use of octal format of mode argument in help(os.chmod) as well as help(os.fchmod)
测试
gh-100454 [https://github.com/python/cpython/issues/100454]: Start running SSL tests with OpenSSL 3.1.0-beta1.
gh-100086 [https://github.com/python/cpython/issues/100086]: The Python test runner (libregrtest) now logs Python build information like "debug" vs "release" build, or LTO and PGO optimizations. Patch by Victor Stinner.
gh-93018 [https://github.com/python/cpython/issues/93018]: Make two tests forgiving towards host system libexpat with backported security fixes applied.
构建
gh-100540 [https://github.com/python/cpython/issues/100540]: Removed the
--with-system-ffi
configure
option;libffi
must now always be supplied by the system on all non-Windows platforms. The option has had no effect on non-Darwin platforms for several releases, and in 3.11 only had the non-obvious effect of invokingpkg-config
to findlibffi
and never setting-DUSING_APPLE_OS_LIBFFI
. Now on Darwin platformsconfigure
will first check for the OSlibffi
and then fall back to the same processing as other platforms if it is not found.gh-88267 [https://github.com/python/cpython/issues/88267]: Avoid exporting Python symbols in linked Windows applications when the core is built as static.
bpo-41916 [https://bugs.python.org/issue?@action=redirect&bpo=41916]: Allow override of ac_cv_cxx_thread so that cross compiled python can set -pthread for CXX.
Windows
gh-100180 [https://github.com/python/cpython/issues/100180]: Update Windows installer to OpenSSL 1.1.1s
gh-99191 [https://github.com/python/cpython/issues/99191]: Use
MSVCLANG >= 202002L
instead of less-preciseMSCVER >=1929
to more accurately test for C++20 support inPC/_wmimodule.cpp
.gh-79218 [https://github.com/python/cpython/issues/79218]: Define
MS_WIN64
for Mingw-w64 64bit, fix cython compilation failure.gh-99941 [https://github.com/python/cpython/issues/99941]: Ensure that
asyncio.Protocol.data_received()
receives an immutablebytes
object (as documented), instead ofbytearray
.bpo-43984 [https://bugs.python.org/issue?@action=redirect&bpo=43984]:
winreg.SetValueEx()
now leaves the target value untouched in the case of conversion errors. Previously,-1
would be written in case of such errors.bpo-34816 [https://bugs.python.org/issue?@action=redirect&bpo=34816]:
hasattr(ctypes.windll, 'nonexistant')
now returnsFalse
instead of raisingOSError
.
macOS
gh-100180 [https://github.com/python/cpython/issues/100180]: Update macOS installer to OpenSSL 1.1.1s
gh-100540 [https://github.com/python/cpython/issues/100540]: Removed obsolete
dlfcn.h
shim from the_ctypes
extension module, which has not been necessary since Mac OS X 10.2.
工具/示例
bpo-45256 [https://bugs.python.org/issue?@action=redirect&bpo=45256]: Fix a bug that caused an
AttributeError
to be raised inpython-gdb.py
whenpy-locals
is used without a frame.gh-100342 [https://github.com/python/cpython/issues/100342]: Add missing
NULL
check for possible allocation failure in*args
parsing in Argument Clinic.
C API
gh-99947 [https://github.com/python/cpython/issues/99947]: Raising SystemError on import will now have its cause be set to the original unexpected exception.
gh-99240 [https://github.com/python/cpython/issues/99240]: In argument parsing, after deallocating newly allocated memory, reset its pointer to NULL.
gh-98724 [https://github.com/python/cpython/issues/98724]: The
Py_CLEAR
,Py_SETREF
andPy_XSETREF
macros now only evaluate their arguments once. If an argument has side effects, these side effects are no longer duplicated. Patch by Victor Stinner.
Python 3.12.0 alpha 3
Release date: 2022-12-06
安全性
- gh-100001 [https://github.com/python/cpython/issues/100001]:
python -m http.server
no longer allows terminal control characters sent within a garbage request to be printed to the stderr server log.
This is done by changing the http.server
BaseHTTPRequestHandler
.log_message
method to replace control characters with a \xHH
hex escape before printing.
- gh-87604 [https://github.com/python/cpython/issues/87604]: Avoid publishing list of active per-interpreter audit hooks via the
gc
module
核心与内置函数
gh-99891 [https://github.com/python/cpython/issues/99891]: Fix a bug in the tokenizer that could cause infinite recursion when showing syntax warnings that happen in the first line of the source. Patch by Pablo Galindo
gh-91054 [https://github.com/python/cpython/issues/91054]: Add
PyCode_AddWatcher()
andPyCode_ClearWatcher()
APIs to register callbacks to receive notification on creation and destruction of code objects.gh-99729 [https://github.com/python/cpython/issues/99729]: Fix an issue that could cause frames to be visible to Python code as they are being torn down, possibly leading to memory corruption or hard crashes of the interpreter.
gh-99708 [https://github.com/python/cpython/issues/99708]: Fix bug where compiler crashes on an if expression with an empty body block.
gh-99578 [https://github.com/python/cpython/issues/99578]: Fix a reference bug in
imp.createbuiltin()
after the creation of the first subinterpreter for modulesbuiltins
andsys
. Patch by Victor Stinner.gh-99581 [https://github.com/python/cpython/issues/99581]: Fixed a bug that was causing a buffer overflow if the tokenizer copies a line missing the newline character from a file that is as long as the available tokenizer buffer. Patch by Pablo galindo
gh-99553 [https://github.com/python/cpython/issues/99553]: Fix bug where an
ExceptionGroup
subclass can wrap aBaseException
.gh-99547 [https://github.com/python/cpython/issues/99547]: Add a function to os.path to check if a path is a junction: isjunction. Add similar functionality to pathlib.Path as is_junction.
gh-99370 [https://github.com/python/cpython/issues/99370]: Fix zip path for venv created from a non-installed python on POSIX platforms.
gh-99377 [https://github.com/python/cpython/issues/99377]: Add audit events for thread creation and clear operations.
gh-98686 [https://github.com/python/cpython/issues/98686]: Remove the
BINARY_OP_GENERIC
andCOMPARE_OP_GENERIC
"specializations".gh-99298 [https://github.com/python/cpython/issues/99298]: Remove the remaining error paths for attribute specializations, and refuse to specialize attribute accesses on types that haven't had
PyType_Ready()
called on them yet.gh-99127 [https://github.com/python/cpython/issues/99127]: Allow some features of
syslog
to the main interpreter only. Patch by Donghee Na.gh-91053 [https://github.com/python/cpython/issues/91053]: Optimizing interpreters and JIT compilers may need to invalidate internal metadata when functions are modified. This change adds the ability to provide a callback that will be invoked each time a function is created, modified, or destroyed.
gh-90994 [https://github.com/python/cpython/issues/90994]: Improve error messages when there's a syntax error with call arguments. The following three cases are covered: - No value is assigned to a named argument, eg
foo(a=)
. - A value is assigned to a star argument, egfoo(*args=[0])
. - A value is assigned to a double-star keyword argument, egfoo(**kwarg={'a': 0})
.bpo-45026 [https://bugs.python.org/issue?@action=redirect&bpo=45026]: Optimize the
range
object iterator. It is now smaller, faster iteration of ranges containing large numbers. Smaller pickles, faster unpickling.bpo-31718 [https://bugs.python.org/issue?@action=redirect&bpo=31718]: Raise
ValueError
instead ofSystemError
when methods of uninitializedio.IncrementalNewlineDecoder
objects are called. Patch by Oren Milman.bpo-38031 [https://bugs.python.org/issue?@action=redirect&bpo=38031]: Fix a possible assertion failure in
io.FileIO
when the opener returns an invalid file descriptor.
库
gh-100001 [https://github.com/python/cpython/issues/100001]: Also escape s in the http.server BaseHTTPRequestHandler.log_message so that it is technically possible to parse the line and reconstruct what the original data was. Without this a xHH is ambiguous as to if it is a hex replacement we put in or the characters r"x" came through in the original request line.
gh-99957 [https://github.com/python/cpython/issues/99957]: Add
frozen_default
parameter totyping.dataclass_transform()
.gh-79033 [https://github.com/python/cpython/issues/79033]: Fix
asyncio.Server.wait_closed()
to actually do what the docs promise — wait for all existing connections to complete, after closing the server.gh-51524 [https://github.com/python/cpython/issues/51524]: Fix bug when calling trace.CoverageResults with valid infile.
gh-99645 [https://github.com/python/cpython/issues/99645]: Fix a bug in handling class cleanups in
unittest.TestCase
. NowaddClassCleanup()
uses separate lists for differentTestCase
subclasses, anddoClassCleanups()
only cleans up the particular class.gh-99508 [https://github.com/python/cpython/issues/99508]: Fix
TypeError
inLib/importlib/bootstrapexternal.py
while callingimp.sourcehash()
.gh-66285 [https://github.com/python/cpython/issues/66285]: Fix
asyncio
to not share event loop and signal wakeupfd in forked processes. Patch by Kumar Aditya.gh-97001 [https://github.com/python/cpython/issues/97001]: Release the GIL when calling termios APIs to avoid blocking threads.
gh-92647 [https://github.com/python/cpython/issues/92647]: Use final status of an enum to determine lookup or creation branch of functional API.
gh-99388 [https://github.com/python/cpython/issues/99388]: Add loop_factory parameter to
asyncio.run()
to allow specifying a custom event loop factory. Patch by Kumar Aditya.gh-99341 [https://github.com/python/cpython/issues/99341]: Fix
ast.increment_lineno()
to also coverast.TypeIgnore
when changing line numbers.gh-99382 [https://github.com/python/cpython/issues/99382]: Check the number of arguments in substitution in user generics containing a
TypeVarTuple
and one or moreTypeVar
.gh-99379 [https://github.com/python/cpython/issues/99379]: Fix substitution of
ParamSpec
followed byTypeVarTuple
in generic aliases.gh-99344 [https://github.com/python/cpython/issues/99344]: Fix substitution of
TypeVarTuple
andParamSpec
together in user generics.gh-99284 [https://github.com/python/cpython/issues/99284]: Remove
usebroken_old_ctypes_structure_semantics_
old untested and undocumented hack fromctypes
.gh-99201 [https://github.com/python/cpython/issues/99201]: Fix
IndexError
when initializing the config variables on Windows ifHAVE_DYNAMIC_LOADING
is not set.gh-99240 [https://github.com/python/cpython/issues/99240]: Fix double-free bug in Argument Clinic
str_converter
by extracting memory clean up to a newpost_parsing
section.gh-64490 [https://github.com/python/cpython/issues/64490]: Fix refcount error when arguments are packed to tuple in Argument Clinic.
gh-99029 [https://github.com/python/cpython/issues/99029]:
pathlib.PurePath.relative_to()
now treats naked Windows drive paths as relative. This brings its behaviour in line with other parts of pathlib.gh-98253 [https://github.com/python/cpython/issues/98253]: The implementation of the typing module is now more resilient to reference leaks in binary extension modules.
Previously, a reference leak in a typed C API-based extension module could leak internals of the typing module, which could in turn introduce leaks in essentially any other package with typed function signatures. Although the typing package is not the original source of the problem, such nonlocal dependences exacerbate debugging of large-scale projects, and the implementation was therefore changed to reduce harm by providing better isolation.
gh-98458 [https://github.com/python/cpython/issues/98458]: Fix infinite loop in unittest when a self-referencing chained exception is raised
gh-93453 [https://github.com/python/cpython/issues/93453]:
asyncio.get_event_loop()
and many otherasyncio
functions likeasyncio.ensure_future()
,asyncio.shield()
orasyncio.gather()
, and also theget_event_loop()
method ofasyncio.BaseDefaultEventLoopPolicy
now raise aRuntimeError
if called when there is no running event loop and the current event loop was not set. Previously they implicitly created and set a new current event loop.DeprecationWarning
is no longer emitted if there is no running event loop but the current event loop was set.gh-97966 [https://github.com/python/cpython/issues/97966]: On
uname_result
, restored expectation that_fields
and_asdict
would include all six properties includingprocessor
.gh-98248 [https://github.com/python/cpython/issues/98248]: Provide informative error messages in
struct.pack()
when its integral arguments are not in range.gh-98108 [https://github.com/python/cpython/issues/98108]:
zipfile.Path
is now pickleable if its initialization parameters were pickleable (e.g. for file system paths).gh-98098 [https://github.com/python/cpython/issues/98098]: Created packages from zipfile and test_zipfile modules, separating
zipfile.Path
functionality.gh-82836 [https://github.com/python/cpython/issues/82836]: Fix
is_private
properties in theipaddress
module. Previously non-private networks (0.0.0.0/0) would returnTrue
from this method; now they correctly returnFalse
.gh-96828 [https://github.com/python/cpython/issues/96828]: Add an
OP_ENABLE_KTLS
option for enabling the use of the kernel TLS (kTLS). Patch by Illia Volochii.gh-88863 [https://github.com/python/cpython/issues/88863]: To avoid apparent memory leaks when
asyncio.open_connection()
raises, break reference cycles generated by local exception and future instances (which has exception instance as its member var). Patch by Dong Uk, Kang.gh-91078 [https://github.com/python/cpython/issues/91078]:
TarFile.next()
now returnsNone
when called on an empty tarfile.bpo-47220 [https://bugs.python.org/issue?@action=redirect&bpo=47220]: Document the optional callback parameter of
WeakMethod
. Patch by Géry Ogam.bpo-44817 [https://bugs.python.org/issue?@action=redirect&bpo=44817]: Ignore WinError 53 (ERROR_BAD_NETPATH), 65 (ERROR_NETWORK_ACCESS_DENIED) and 161 (ERROR_BAD_PATHNAME) when using ntpath.realpath().
bpo-41260 [https://bugs.python.org/issue?@action=redirect&bpo=41260]: Rename the fmt parameter of the pure Python implementation of
datetime.date.strftime()
to format.bpo-15999 [https://bugs.python.org/issue?@action=redirect&bpo=15999]: All builtin functions now accept arguments of any type instead of just
bool
andint
for boolean parameters.
文档
gh-99931 [https://github.com/python/cpython/issues/99931]: Use sphinxext-opengraph [https://sphinxext-opengraph.readthedocs.io/] to generate OpenGraph metadata [https://ogp.me/].
gh-89682 [https://github.com/python/cpython/issues/89682]: Reworded docstring of the default
__contains__
to clarify that it returns abool
.gh-88330 [https://github.com/python/cpython/issues/88330]: Improved the description of what a resource is in importlib.resources docs.
gh-92892 [https://github.com/python/cpython/issues/92892]: Document that calling variadic functions with ctypes requires special care on macOS/arm64 (and possibly other platforms).
bpo-41825 [https://bugs.python.org/issue?@action=redirect&bpo=41825]: Restructured the documentation for the
os.wait*
family of functions, and improved the docs foros.waitid()
with more explanation of the possible argument constants.
测试
gh-99892 [https://github.com/python/cpython/issues/99892]: Skip test_normalization() of test_unicodedata if it fails to download NormalizationTest.txt file from pythontest.net. Patch by Victor Stinner.
gh-99934 [https://github.com/python/cpython/issues/99934]: Correct test_marsh on (32 bit) x86: test_deterministic sets was failing.
gh-99741 [https://github.com/python/cpython/issues/99741]: We've implemented multiphase init (PEP 489/630/687) for the internal (for testing) _xxsubinterpreters module.
gh-99659 [https://github.com/python/cpython/issues/99659]: Optional big memory tests in
test_sqlite3
now catch the correctsqlite.DataError
exception type in case of too large strings and/or blobs passed.gh-99593 [https://github.com/python/cpython/issues/99593]: Cover the Unicode C API with tests.
gh-96002 [https://github.com/python/cpython/issues/96002]: Add functional test for Argument Clinic.
构建
gh-99086 [https://github.com/python/cpython/issues/99086]: Fix
-Wimplicit-int
,-Wstrict-prototypes
, and-Wimplicit-function-declaration
compiler warnings in configure checks.gh-99337 [https://github.com/python/cpython/issues/99337]: Fix a compilation issue with GCC 12 on macOS.
gh-99289 [https://github.com/python/cpython/issues/99289]: Add a
COMPILEALL_OPTS
variable in Makefile to overridecompileall
options (default:-j0
) inmake install
. Also merged thecompileall
commands into a single command building .pyc files for the all optimization levels (0, 1, 2) at once. Patch by Victor Stinner.gh-98872 [https://github.com/python/cpython/issues/98872]: Fix a possible fd leak in
Programs/freezemodule.c
introduced in Python 3.11.gh-88226 [https://github.com/python/cpython/issues/88226]: Always define
TARGET_*
labels inPython/ceval.c
, even ifUSE_COMPUTED_GOTOS
is disabled. This allows breakpoints to be set at those labels in (for instance)gdb
.
Windows
gh-99345 [https://github.com/python/cpython/issues/99345]: Use faster initialization functions to detect install location for Windows Store package
gh-98629 [https://github.com/python/cpython/issues/98629]: Fix initialization of
sys.version
andsys._git
on Windowsgh-99442 [https://github.com/python/cpython/issues/99442]: Fix handling in 适用于Windows的Python启动器 when
argv[0]
does not include a file extension.bpo-40882 [https://bugs.python.org/issue?@action=redirect&bpo=40882]: Fix a memory leak in
multiprocessing.shared_memory.SharedMemory
on Windows.
macOS
gh-87235 [https://github.com/python/cpython/issues/87235]: On macOS
python3 devfd/9 9
failed for any script longer than a couple of bytes.gh-98940 [https://github.com/python/cpython/issues/98940]: Fix
Mac/Extras.install.py
file filter bug.
工具/示例
gh-64490 [https://github.com/python/cpython/issues/64490]: Argument Clinic varargs bugfixes
Fix out-of-bounds error in
PyArgUnpackKeywordsWithVararg()
.Fix incorrect check which allowed more than one varargs in clinic.py.
Fix miscalculation of
noptargs
in generated code.Do not generate
noptargs
when there is a vararg argument and no optional argument.
C API
gh-98680 [https://github.com/python/cpython/issues/98680]:
PyBUF_*
constants were marked as part of Limited API of Python 3.11+. These were available in 3.11.0 withPy_LIMITED_API
defined for 3.11, and are necessary to use the buffer API.gh-99612 [https://github.com/python/cpython/issues/99612]: Fix
PyUnicode_DecodeUTF8Stateful()
for ASCII-only data:*consumed
was not set.gh-47146 [https://github.com/python/cpython/issues/47146]: The
structmember.h
header is deprecated. Its non-deprecated contents are now available just by includingPython.h
, with aPy_
prefix added if it was missing. (Deprecated contents areT_OBJECT
,T_NONE
, and no-op flags.) Patch by Petr Viktorin, based on earlier work by Alexander Belopolsky and Matthias Braun.
Python 3.12.0 alpha 2
Release date: 2022-11-14
安全性
- gh-98433 [https://github.com/python/cpython/issues/98433]: The IDNA codec decoder used on DNS hostnames by
socket
orasyncio
related name resolution functions no longer involves a quadratic algorithm. This prevents a potential CPU denial of service if an out-of-spec excessive length hostname involving bidirectional characters were decoded. Some protocols such asurllib
http3xx
redirects potentially allow for an attacker to supply such a name.
Individual labels within an IDNA encoded DNS name will now raise an error early during IDNA decoding if they are longer than 1024 unicode characters given that each decoded DNS label must be 63 or fewer characters and the entire decoded DNS name is limited to 255. Only an application presenting a hostname or label consisting primarily of RFC 3454 [https://datatracker.ietf.org/doc/html/rfc3454.html] section 3.1 "Nothing" characters to be removed would run into of this new limit. See also RFC 5894 [https://datatracker.ietf.org/doc/html/rfc5894.html] section 6 and RFC 3491 [https://datatracker.ietf.org/doc/html/rfc3491.html].
- gh-98739 [https://github.com/python/cpython/issues/98739]: Update bundled libexpat to 2.5.0
核心与内置函数
gh-81057 [https://github.com/python/cpython/issues/81057]: The docs clearly say that
PyImport_Inittab
,PyImport_AppendInittab()
, andPyImport_ExtendInittab()
should not be used afterPy_Initialize()
has been called. We now enforce this for the two functions. Additionally, the runtime now uses an internal copy ofPyImport_Inittab
, to guard against modification.gh-99298 [https://github.com/python/cpython/issues/99298]: Fix an issue that could potentially cause incorrect error handling for some bytecode instructions.
gh-99254 [https://github.com/python/cpython/issues/99254]: The compiler now removes all unused constants from code objects (except the first one, which may be a docstring).
gh-99205 [https://github.com/python/cpython/issues/99205]: Fix an issue that prevented
PyThreadState
andPyInterpreterState
memory from being freed properly.gh-81057 [https://github.com/python/cpython/issues/81057]: The 18 global C variables holding the state of the allocators have been moved to
_PyRuntimeState
. This is a strictly internal change with no change in behavior.gh-99181 [https://github.com/python/cpython/issues/99181]: Fix failure in
except*
with unhashable exceptions.gh-99204 [https://github.com/python/cpython/issues/99204]: Fix calculation of
sys._base_executable
when inside a POSIX virtual environment using copies of the python binary when the base installation does not provide the executable name used by the venv. Calculation will fall back to alternative names ("python", "python . "). gh-96055 [https://github.com/python/cpython/issues/96055]: Update
faulthandler
to emit an error message with the proper unexpected signal number. Patch by Donghee Na.gh-99153 [https://github.com/python/cpython/issues/99153]: Fix location of
SyntaxError
for atry
block with bothexcept
andexcept*
.gh-98686 [https://github.com/python/cpython/issues/98686]: Merge the adaptive opcode logic into each instruction's unquickened variant, and merge the logic in
EXTENDED_ARG_QUICK
intoEXTENDED_ARG
. With these changes, the quickening that happens at code object creation is now only responsible for initializing warmup counters and inserting superinstructions.gh-99103 [https://github.com/python/cpython/issues/99103]: Fix the error reporting positions of specialized traceback anchors when the source line contains Unicode characters.
gh-99139 [https://github.com/python/cpython/issues/99139]: Improve the error suggestion for
NameError
exceptions for instances. Now if aNameError
is raised in a method and the instance has an attribute that's exactly equal to the name in the exception, the suggestion will includeself.
instead of the closest match in the method scope. Patch by Pablo Galindogh-98401 [https://github.com/python/cpython/issues/98401]: Octal escapes with value larger than
0o377
(ex:"\477"
), deprecated in Python 3.11, now produce aSyntaxWarning
, instead ofDeprecationWarning
. In a future Python version they will be eventually aSyntaxError
. Patch by Victor Stinner.gh-98401 [https://github.com/python/cpython/issues/98401]: A backslash-character pair that is not a valid escape sequence now generates a
SyntaxWarning
, instead ofDeprecationWarning
. For example,re.compile("\d+.\d+")
now emits aSyntaxWarning
("\d"
is an invalid escape sequence), use raw strings for regular expression:re.compile(r"\d+.\d+")
. In a future Python version,SyntaxError
will eventually be raised, instead ofSyntaxWarning
. Patch by Victor Stinner.gh-96793 [https://github.com/python/cpython/issues/96793]: Handle StopIteration and StopAsyncIteration raised in generator or coroutines in the bytecode, rather than in wrapping C code.
gh-98931 [https://github.com/python/cpython/issues/98931]: Improve the
SyntaxError
error message when the user typesimport x from y
instead offrom y import x
. Patch by Pablo Galindogh-98852 [https://github.com/python/cpython/issues/98852]: Fix subscription of type aliases containing bare generic types or types like
TypeVar
: for exampletuple[A, T][int]
andtuple[TypeVar, T][int]
, whereA
is a generic type, andT
is a type variable.gh-98925 [https://github.com/python/cpython/issues/98925]: Lower the recursion depth for marshal on WASI to support (in-development) wasmtime 2.0.
gh-98783 [https://github.com/python/cpython/issues/98783]: Fix multiple crashes in debug mode when
str
subclasses are used instead ofstr
itself.gh-98811 [https://github.com/python/cpython/issues/98811]: Use complete source locations to simplify detection of
__future__
imports which are not at the beginning of the file. Also corrects the offset in the exception raised in one case, which was off by one and impeded highlighting.gh-96793 [https://github.com/python/cpython/issues/96793]: Add specialization of
FOR_ITER
for generators. Saves multiple layers of dispatch and checking to get from theFOR_ITER
instruction in the caller to theRESUME
in the generator.gh-98762 [https://github.com/python/cpython/issues/98762]: Fix source locations of
match
subpatterns.gh-98586 [https://github.com/python/cpython/issues/98586]: Added the methods
PyObject_Vectorcall()
andPyObject_VectorcallMethod()
to the Limited API along with the auxiliary macro constantPY_VECTORCALL_ARGUMENTS_OFFSET
.
The availability of these functions enables more efficient PEP 590 [https://peps.python.org/pep-0590/] vector calls from binary extension modules that avoid argument boxing/unboxing overheads.
gh-99257 [https://github.com/python/cpython/issues/99257]: Fix an issue where member descriptors (such as those for
__slots__
) could behave incorrectly or crash instead of raising aTypeError
when accessed via an instance of an invalid type.gh-93143 [https://github.com/python/cpython/issues/93143]: Rather than changing
co_code
, the interpreter will now display aRuntimeWarning
and assignNone
to any fast locals that are left unbound after jumps ordel
statements executed while tracing.gh-96421 [https://github.com/python/cpython/issues/96421]: When calling into Python code from C code, through
PyEval_EvalFrameEx()
or a related C-API function, a shim frame in inserted into the call stack. This occurs in thePyEvalEvalFrameDefault()
function. The extra frame should be invisible to all Python and most C extensions, but out-of-process profilers and debuggers need to be aware of it. These shim frames can be detected by checkingframe->owner == FRAME_OWNED_BY_CSTACK
.
Extensions implementing their own interpreters using PEP 523 need to be aware of this shim frame and the changes to the semantics of RETURN_VALUE
, YIELD_VALUE
, and RETURN_GENERATOR
, which now clear the frame.
gh-98415 [https://github.com/python/cpython/issues/98415]: Fix detection of MAC addresses for
uuid
on certain OSs. Patch by Chaim Sandersgh-98686 [https://github.com/python/cpython/issues/98686]: Quicken all code objects, and specialize adaptive bytecode instructions more aggressively.
gh-92119 [https://github.com/python/cpython/issues/92119]: Print exception class name instead of its string representation when raising errors from
ctypes
calls.gh-91058 [https://github.com/python/cpython/issues/91058]:
ImportError
raised from failedfrom
now include suggestions for the value ofimport
based on the available names in
. Patch by Pablo Galindogh-96793 [https://github.com/python/cpython/issues/96793]: The
FOR_ITER
now leaves the iterator on the stack on termination of the loop. This is to assist specialization of loops for generators.gh-90716 [https://github.com/python/cpython/issues/90716]: Add _pylong.py module. It includes asymptotically faster algorithms that can be used for operations on integers with many digits. It is used by longobject.c to speed up some operations.
gh-95389 [https://github.com/python/cpython/issues/95389]: Expose
ETH_P_ALL
and some of the ETHERTYPE_* constants insocket
. Patch by Noam Cohen.gh-93696 [https://github.com/python/cpython/issues/93696]: Allow
pdb
to locate source for frozen modules in the standard library.
库
gh-99418 [https://github.com/python/cpython/issues/99418]: Fix bug in
urllib.parse.urlparse()
that causes URL schemes that begin with a digit, a plus sign, or a minus sign to be parsed incorrectly.gh-94597 [https://github.com/python/cpython/issues/94597]: Deprecate
asyncio.AbstractChildWatcher
to be removed in Python 3.14. Patch by Kumar Aditya.gh-99305 [https://github.com/python/cpython/issues/99305]: Improve performance of
secrets.token_hex()
.gh-74044 [https://github.com/python/cpython/issues/74044]: Fixed bug where
inspect.signature()
reported incorrect arguments for decorated methods.gh-99275 [https://github.com/python/cpython/issues/99275]: Fix
SystemError
inctypes
when exception was not set during__initsubclass__
.gh-99277 [https://github.com/python/cpython/issues/99277]: Remove older version of
_SSLProtocolTransport.getwritebuffer_limits
inasyncio.sslproto
gh-99248 [https://github.com/python/cpython/issues/99248]: fix negative numbers failing in verify()
gh-99155 [https://github.com/python/cpython/issues/99155]: Fix
statistics.NormalDist
pickle with0
and1
protocols.gh-93464 [https://github.com/python/cpython/issues/93464]:
enum.auto()
is now correctly activated when combined with other assignment values. E.g.ONE = auto(), 'some text'
will now evaluate as(1, 'some text')
.gh-99134 [https://github.com/python/cpython/issues/99134]: Update the bundled copy of pip to version 22.3.1.
gh-92584 [https://github.com/python/cpython/issues/92584]: Remove the
distutils
package. It was deprecated in Python 3.10 by PEP 632 [https://peps.python.org/pep-0632/] "Deprecate distutils module". For projects still usingdistutils
and cannot be updated to something else, thesetuptools
project can be installed: it still providesdistutils
. Patch by Victor Stinner.gh-98999 [https://github.com/python/cpython/issues/98999]: Now
_pyio
is consistent with_io
in raisingValueError
when executing methods over closed buffers.gh-83004 [https://github.com/python/cpython/issues/83004]: Clean up refleak on failed module initialisation in
_zoneinfo
gh-83004 [https://github.com/python/cpython/issues/83004]: Clean up refleaks on failed module initialisation in
_pickle
gh-83004 [https://github.com/python/cpython/issues/83004]: Clean up refleak on failed module initialisation in
_io
.gh-98897 [https://github.com/python/cpython/issues/98897]: Fix memory leak in
math.dist()
when both points don't have the same dimension. Patch by Kumar Aditya.gh-98878 [https://github.com/python/cpython/issues/98878]: Use the frame bound builtins when offering a name suggestion in
traceback
to prevent crashing when__builtins__
is not a dict.gh-98139 [https://github.com/python/cpython/issues/98139]: In
importlib._bootstrap
, enhance namespace package repr to
.gh-90352 [https://github.com/python/cpython/issues/90352]: Fix
_SelectorDatagramTransport
to inherit fromDatagramTransport
inasyncio
. Patch by Kumar Aditya.gh-98793 [https://github.com/python/cpython/issues/98793]: Fix argument typechecks in
_overlapped.WSAConnect()
and_overlapped.Overlapped.WSASendTo()
functions.gh-98744 [https://github.com/python/cpython/issues/98744]: Prevent crashing in
traceback
when retrieving the byte-offset for some source files that contain certain unicode characters.gh-98740 [https://github.com/python/cpython/issues/98740]: Fix internal error in the
re
module which in very rare circumstances prevented compilation of a regular expression containing a conditional expression without the "else" branch.gh-98703 [https://github.com/python/cpython/issues/98703]: Fix
asyncio.StreamWriter.drain()
to callprotocol.connection_lost
callback only once on Windows.gh-98624 [https://github.com/python/cpython/issues/98624]: Add a mutex to unittest.mock.NonCallableMock to protect concurrent access to mock attributes.
gh-98658 [https://github.com/python/cpython/issues/98658]: The
array.array
class now supports subscripting, making it a generic type.gh-98284 [https://github.com/python/cpython/issues/98284]: Improved
TypeError
message for undefined abstract methods of aabc.ABC
instance. The names of the missing methods are surrounded by single-quotes to highlight them.gh-96151 [https://github.com/python/cpython/issues/96151]: Allow
BUILTINS
to be a valid field name for frozen dataclasses.gh-98086 [https://github.com/python/cpython/issues/98086]: Make sure
patch.dict()
can be applied on async functions.gh-72719 [https://github.com/python/cpython/issues/72719]: Remove modules
asyncore
andasynchat
, which were deprecated by PEP 594 [https://peps.python.org/pep-0594/].gh-96192 [https://github.com/python/cpython/issues/96192]: Fix handling of
bytes
pathlike objects inos.ismount()
.gh-94172 [https://github.com/python/cpython/issues/94172]:
ftplib
: Remove theFTP_TLS.ssl_version
class attribute: use the context parameter instead. Patch by Victor Stinnergh-94172 [https://github.com/python/cpython/issues/94172]: Remove the keyfile and certfile parameters from the
ftplib
,imaplib
,poplib
andsmtplib
modules, and the key_file, cert_file and check_hostname parameters from thehttp.client
module, all deprecated since Python 3.6. Use the context parameter (ssl_context inimaplib
) instead. Patch by Victor Stinner.gh-83638 [https://github.com/python/cpython/issues/83638]: Add the
autocommit
attribute tosqlite3.Connection
and the autocommit parameter tosqlite3.connect()
to control PEP 249 [https://peps.python.org/pep-0249/]-compliant transaction handling. Patch by Erlend E. Aasland.gh-92452 [https://github.com/python/cpython/issues/92452]: Fixed a race condition that could cause
sysconfig.getconfigvar()
to incorrectly returnNone
in multithreaded programs.gh-91803 [https://github.com/python/cpython/issues/91803]: Fix an error when using a method of objects mocked with
unittest.mock.create_autospec()
after it was sealed withunittest.mock.seal()
function.bpo-38523 [https://bugs.python.org/issue?@action=redirect&bpo=38523]:
shutil.copytree()
now applies the ignore_dangling_symlinks argument recursively.bpo-40358 [https://bugs.python.org/issue?@action=redirect&bpo=40358]: Add walk_up argument in
pathlib.PurePath.relative_to()
.bpo-36267 [https://bugs.python.org/issue?@action=redirect&bpo=36267]: Fix IndexError in
argparse.ArgumentParser
when astore_true
action is given an explicit argument.
文档
gh-98832 [https://github.com/python/cpython/issues/98832]: Changes wording of docstring for
pathlib.Path.iterdir()
.gh-97966 [https://github.com/python/cpython/issues/97966]: Update uname docs to clarify the special nature of the platform attribute and to indicate when it became late-bound.
测试
gh-98903 [https://github.com/python/cpython/issues/98903]: The Python test suite now fails with exit code 4 if no tests ran. It should help detecting typos in test names and test methods.
gh-98713 [https://github.com/python/cpython/issues/98713]: Fix a bug in the
typing
tests where a test relying on CPython-specific implementation details was not decorated with@cpython_only
and was not skipped on other implementations.gh-87390 [https://github.com/python/cpython/issues/87390]: Add tests for star-unpacking with PEP 646, and some other miscellaneous PEP 646 tests.
gh-96853 [https://github.com/python/cpython/issues/96853]: Added explicit coverage of
Py_Initialize
(and hencePy_InitializeEx
) back to the embedding tests (all other embedding tests migrated toPy_InitializeFromConfig
in Python 3.11)bpo-34272 [https://bugs.python.org/issue?@action=redirect&bpo=34272]: Some C API tests were moved into the new Lib/test/test_capi/ directory.
构建
gh-99086 [https://github.com/python/cpython/issues/99086]: Fix
-Wimplicit-int
compiler warning in configure check forPTHREAD_SCOPE_SYSTEM
.gh-99016 [https://github.com/python/cpython/issues/99016]: Fix build with
PYTHON_FOR_REGEN=python3.8
.gh-97731 [https://github.com/python/cpython/issues/97731]: Specify the full path to the source location for
make docclean
(needed for cross-builds).gh-98949 [https://github.com/python/cpython/issues/98949]: Drop unused build dependency on
readelf
.gh-98989 [https://github.com/python/cpython/issues/98989]: Use
python3.11
, if available, for regeneration and freezing.gh-98831 [https://github.com/python/cpython/issues/98831]: Add new tooling, in
Tools/cases_generator
, to generate the interpreter switch statement from a list of opcode definitions. This only affects adding, modifying or removing instruction definitions. The instruction definitions now live inPython/bytecodes.c
, in the form of a custom DSL (under development) [https://github.com/faster-cpython/ideas/blob/main/3.12/interpreter_definition.md]. The tooling reads this file and writesPython/generated_cases.c.h
, which is then included byPython/ceval.c
to provide most of the cases of the main interpreter switch.gh-98817 [https://github.com/python/cpython/issues/98817]: Remove PCbuild/lib.pyproj: it's not used for anything, is only a minor convenience for Visual Studio users (who probably mostly don't even know about it), and it takes a lot of maintenance effort to keep updated.
gh-98776 [https://github.com/python/cpython/issues/98776]: Fix
make regen-test-levenshtein
for out-of-tree builds.gh-98707 [https://github.com/python/cpython/issues/98707]: Don't use vendored
libmpdec
headers if--with-system-libmpdec
is passed to configure. Don't use vendoredlibexpat
headers if--with-system-expat
is passed to configure.
Windows
gh-98689 [https://github.com/python/cpython/issues/98689]: Update Windows builds to zlib v1.2.13. v1.2.12 has CVE 2022-37434 [https://www.cve.org/CVERecord?id=CVE-2022-37434], but the vulnerable
inflateGetHeader
API is not used by Python.gh-98790 [https://github.com/python/cpython/issues/98790]: Assumes that a missing
DLLs
directory means that standard extension modules are in the executable's directory.gh-98745 [https://github.com/python/cpython/issues/98745]: Update
py.exe
launcher to install 3.11 by default and 3.12 on request.gh-98692 [https://github.com/python/cpython/issues/98692]: Fix the 适用于Windows的Python启动器 ignoring unrecognized shebang lines instead of treating them as local paths
gh-94328 [https://github.com/python/cpython/issues/94328]: Update Windows installer to use SQLite 3.39.4.
macOS
- gh-94328 [https://github.com/python/cpython/issues/94328]: Update macOS installer to SQLite 3.39.4.
C API
gh-98724 [https://github.com/python/cpython/issues/98724]: The
Py_CLEAR
,Py_SETREF
andPy_XSETREF
macros now only evaluate their argument once. If the argument has side effects, these side effects are no longer duplicated. Patch by Victor Stinner.gh-98978 [https://github.com/python/cpython/issues/98978]: Fix use-after-free in
Py_SetPythonHome(NULL)
,Py_SetProgramName(NULL)
andPySetProgramFullPath(NULL)
function calls. Issue reported by Benedikt Reinartz. Patch by Victor Stinner.gh-98410 [https://github.com/python/cpython/issues/98410]: Add
getbufferproc
andreleasebufferproc
to the stable API.gh-98610 [https://github.com/python/cpython/issues/98610]: Some configurable capabilities of subinterpreters have changed. They always allow subprocesses (
subprocess
) now, whereas before subprocesses could be optionally disallowed for a subinterpreter. Insteados.exec()
can now be disallowed. Disallowing daemon threads is now supported. Disallowing all threads is still allowed, but is never done by default. Note that the optional restrictions are only available throughPyNewInterpreterFromConfig()
, which isn't a public API. They do not affect the main interpreter, norPy_NewInterpreter()
.gh-98608 [https://github.com/python/cpython/issues/98608]: A
_PyInterpreterConfig
has been added andPyNewInterpreter()
has been renamed toPyNewInterpreterFromConfig()
. The "isolated_subinterpreters" argument is now a granular config that captures the previous behavior. Note that this is all "private" API.gh-96853 [https://github.com/python/cpython/issues/96853]:
Py_InitializeEx
now correctly callsPyConfig_Clear
after initializing the interpreter (the omission didn't cause a memory leak only because none of the dynamically allocated config fields are populated by the wrapper function)gh-91248 [https://github.com/python/cpython/issues/91248]: Add
PyFrame_GetVar()
andPyFrame_GetVarString()
functions to get a frame variable by its name. Patch by Victor Stinner.