核心与内置函数
gh-102192 [https://github.com/python/cpython/issues/102192]: Deprecated
PyErrChainExceptions
in favour ofPyErrChainExceptions1
.gh-89987 [https://github.com/python/cpython/issues/89987]: Reduce the number of inline
CACHE
entries forBINARY_SUBSCR
.gh-102859 [https://github.com/python/cpython/issues/102859]: Removed
JUMP_IF_FALSE_OR_POP
andJUMP_IF_TRUE_OR_POP
instructions.gh-101975 [https://github.com/python/cpython/issues/101975]: Fixed
stacktop
value on tracing entries to avoid corruption on garbage collection.gh-102778 [https://github.com/python/cpython/issues/102778]: Add
sys.last_exc
and deprecatesys.last_type
,sys.last_value
andsys.last_traceback
, which hold the same information in its legacy form.gh-100982 [https://github.com/python/cpython/issues/100982]: Replace all occurrences of
COMPARE_AND_BRANCH
withCOMPARE_OP
.gh-102701 [https://github.com/python/cpython/issues/102701]: Fix overflow when creating very large dict.
gh-102755 [https://github.com/python/cpython/issues/102755]: Add
PyErr_DisplayException()
which takes just an exception instance, to replace the legacyPyErr_Display()
which takes the(typ, exc, tb)
triplet.gh-102594 [https://github.com/python/cpython/issues/102594]: Add note to exception raised in
PyErr_SetObject
when normalization fails.gh-90997 [https://github.com/python/cpython/issues/90997]: Shrink the number of inline
CACHE
entries used byLOAD_GLOBAL
.gh-102491 [https://github.com/python/cpython/issues/102491]: Improve import time of
platform
by removing IronPython version parsing. The IronPython version parsing was not functional (see https://github.com/IronLanguages/ironpython3/issues/1667).gh-101291 [https://github.com/python/cpython/issues/101291]: Rearrage bits in first field (after header) of PyLongObject. Bits 0 and 1: 1 - sign. I.e. 0 for positive numbers, 1 for zero and 2 for negative numbers. Bit 2 reserved (probably for the immortal bit) * Bits 3+ the unsigned size.
This makes a few operations slightly more efficient, and will enable a more compact and faster 2s-complement representation of most ints in future.
gh-102397 [https://github.com/python/cpython/issues/102397]: Fix segfault from race condition in signal handling during garbage collection. Patch by Kumar Aditya.
gh-102406 [https://github.com/python/cpython/issues/102406]:
codecs
encoding/decoding errors now get the context information (which operation and which codecs) attached as PEP 678 [https://peps.python.org/pep-0678/] notes instead of through chaining a new instance of the exception.gh-102281 [https://github.com/python/cpython/issues/102281]: Fix potential nullptr dereference and use of uninitialized memory in fileutils. Patch by Max Bachmann.
gh-102300 [https://github.com/python/cpython/issues/102300]: Reuse operands with refcount of 1 in float specializations of BINARY_OP.
gh-102213 [https://github.com/python/cpython/issues/102213]: Fix performance loss when accessing an object's attributes with
__getattr__
defined.gh-102255 [https://github.com/python/cpython/issues/102255]: Improve build support for the Xbox. Patch by Max Bachmann.
gh-102027 [https://github.com/python/cpython/issues/102027]: Fix SSE2 and SSE3 detection in
_blake2
internal module. Patch by Max Bachmann.gh-101865 [https://github.com/python/cpython/issues/101865]: Deprecate
co_lnotab
in code objects, schedule it for removal in Python 3.14bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Adapt
_pickle
to PEP 687 [https://peps.python.org/pep-0687/]. Patch by Mohamed Koubaa and Erlend Aasland.
库
gh-103085 [https://github.com/python/cpython/issues/103085]: Pure python
locale.getencoding()
will not warn deprecation.gh-103068 [https://github.com/python/cpython/issues/103068]: It's no longer possible to register conditional breakpoints in
Pdb
that raiseSyntaxError
. Patch by Tian Gao.gh-102549 [https://github.com/python/cpython/issues/102549]: Don't ignore exceptions in member type creation.
gh-103056 [https://github.com/python/cpython/issues/103056]: Ensure final
generatenext_value_
is astaticmethod
.gh-103046 [https://github.com/python/cpython/issues/103046]: Display current line label correctly in
dis
whenshow_caches
is False andlasti
points to a CACHE entry.gh-102433 [https://github.com/python/cpython/issues/102433]:
isinstance()
checks againstruntime-checkable protocols
now useinspect.getattr_static()
rather thanhasattr()
to lookup whether attributes exist. This means that descriptors and__getattr__()
methods are no longer unexpectedly evaluated duringisinstance()
checks against runtime-checkable protocols. However, it may also mean that some objects which used to be considered instances of a runtime-checkable protocol may no longer be considered instances of that protocol on Python 3.12+, and vice versa. Most users are unlikely to be affected by this change. Patch by Alex Waygood.gh-103023 [https://github.com/python/cpython/issues/103023]: It's no longer possible to register expressions to display in
Pdb
that raiseSyntaxError
. Patch by Tian Gao.gh-102947 [https://github.com/python/cpython/issues/102947]: Improve traceback when
dataclasses.fields()
is called on a non-dataclass. Patch by Alex Waygoodgh-102780 [https://github.com/python/cpython/issues/102780]: The
asyncio.Timeout
context manager now works reliably even when performing cleanup due to task cancellation. Previously it could raise aCancelledError
instead of anTimeoutError
in such cases.gh-102871 [https://github.com/python/cpython/issues/102871]: Remove support for obsolete browsers from
webbrowser
. Removed browsers include Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, Firebird, and Firefox versions 35 and below.gh-102839 [https://github.com/python/cpython/issues/102839]: Improve performance of
math.log()
arguments handling by removing the argument clinic.gh-102828 [https://github.com/python/cpython/issues/102828]: Add the
onexc
arg toshutil.rmtree()
, which is likeonerror
but expects an exception instance rather than an exc_info tuple. Deprecateonerror
.gh-88965 [https://github.com/python/cpython/issues/88965]: typing: Fix a bug relating to substitution in custom classes generic over a
ParamSpec
. Previously, if theParamSpec
was substituted with a parameters list that itself contained aTypeVar
, theTypeVar
in the parameters list could not be subsequently substituted. This is now fixed.
Patch by Nikita Sobolev.
gh-76846 [https://github.com/python/cpython/issues/76846]: Fix issue where
_new_()
and__init__()
methods ofpathlib.PurePath
andPath
subclasses were not called in some circumstances.gh-78530 [https://github.com/python/cpython/issues/78530]:
asyncio.wait()
now accepts generators yielding tasks. Patch by Kumar Aditya.gh-102748 [https://github.com/python/cpython/issues/102748]:
asyncio.iscoroutine()
now returnsFalse
for generators asasyncio
does not support legacy generator-based coroutines. Patch by Kumar Aditya.gh-102670 [https://github.com/python/cpython/issues/102670]: Optimized fmean(), correlation(), covariance(), and linear_regression() using the new math.sumprod() function.
gh-102615 [https://github.com/python/cpython/issues/102615]: Typing: Improve the
repr
of generic aliases for classes generic over aParamSpec
. (Use square brackets to represent a parameter list.)gh-100112 [https://github.com/python/cpython/issues/100112]:
asyncio.Task.get_coro()
now always returns a coroutine when wrapping an awaitable object. Patch by Kumar Aditya.gh-102578 [https://github.com/python/cpython/issues/102578]: Speed up setting or deleting mutable attributes on non-dataclass subclasses of frozen dataclasses. Due to the implementation of
__setattr__
and__delattr__
for frozen dataclasses, this previously had a time complexity of O(n). It now has a time complexity of O(1).gh-102519 [https://github.com/python/cpython/issues/102519]: Add
os.listdrives()
,os.listvolumes()
andos.listmounts()
functions on Windows for enumerating drives, volumes and mount pointsgh-74468 [https://github.com/python/cpython/issues/74468]: Attribute name of the extracted
tarfile
file object now holds filename of itself rather than of the archive it is contained in. Patch by Oleg Iarygin.gh-102378 [https://github.com/python/cpython/issues/102378]: Private helper method
inspect.signaturestrip_non_python_syntax
will no longer strip/
from the input string.gh-79940 [https://github.com/python/cpython/issues/79940]: Add
inspect.getasyncgenstate()
andinspect.getasyncgenlocals()
. Patch by Thomas Krennwallner.gh-102103 [https://github.com/python/cpython/issues/102103]: Add
module
argument todataclasses.make_dataclass()
and make classes produced by it pickleable.gh-102069 [https://github.com/python/cpython/issues/102069]: Fix
__weakref__
descriptor generation for custom dataclasses.gh-102038 [https://github.com/python/cpython/issues/102038]: Skip a
stat
insite
if we have already found apyvenv.cfg
gh-98886 [https://github.com/python/cpython/issues/98886]: Fix issues when defining dataclasses that have fields with specific underscore names that aren't clearly reserved by
dataclasses
.gh-101673 [https://github.com/python/cpython/issues/101673]: Fix a
pdb
bug wherell
clears the changes to local variables.gh-101313 [https://github.com/python/cpython/issues/101313]: Added -h and —help arguments to the webbrowser CLI
gh-100372 [https://github.com/python/cpython/issues/100372]:
ssl.SSLContext.load_verify_locations()
no longer incorrectly accepts some cases of trailing data when parsing DER.gh-89727 [https://github.com/python/cpython/issues/89727]: Fix pathlib.Path.walk RecursionError on deep directory trees by rewriting it using iteration instead of recursion.
gh-100131 [https://github.com/python/cpython/issues/100131]: Added an optional
delete
keyword argument totempfile.TemporaryDirectory
.gh-48330 [https://github.com/python/cpython/issues/48330]: Added
--durations
command line option, showing the N slowest test cases.unittest.TextTestRunner
andunittest.TextTestResult
constructors accept a new durations keyword argument. Subclasses should take this into account or accept**kwargs
. Addedunittest.TestResult.addDuration()
method andunittest.TestResult.collectedDurations
attribute.
(Contributed by Giampaolo Rodola)
gh-98169 [https://github.com/python/cpython/issues/98169]: Fix
dataclasses.astuple()
crash whencollections.defaultdict
is present in the attributes.gh-96931 [https://github.com/python/cpython/issues/96931]: Fix incorrect results from
ssl.SSLSocket.shared_ciphers()
gh-95495 [https://github.com/python/cpython/issues/95495]: When built against OpenSSL 3.0, the
ssl
module had a bug where it reported unauthenticated EOFs (i.e. without close_notify) as a clean TLS-level EOF. It now raisesSSLEOFError
, matching the behavior in previous versions of OpenSSL. Theoptions
attribute onSSLContext
also no longer includesOP_IGNORE_UNEXPECTED_EOF
by default. This option may be set to specify the previous OpenSSL 3.0 behavior.gh-94684 [https://github.com/python/cpython/issues/94684]: Now
uuid.uuid3()
anduuid.uuid5()
functions supportbytes
objects as their name argument.gh-94440 [https://github.com/python/cpython/issues/94440]: Fix a
concurrent.futures.process
bug whereProcessPoolExecutor
shutdown could hang after a future has been quickly submitted and canceled.gh-72346 [https://github.com/python/cpython/issues/72346]: Added deprecation warning to isdst parameter of
email.utils.localtime()
.bpo-36305 [https://bugs.python.org/issue?@action=redirect&bpo=36305]: Fix handling of Windows filenames that resemble drives, such as
./a:b
, inpathlib
.
文档
- gh-103112 [https://github.com/python/cpython/issues/103112]: Add docstring to
http.client.HTTPResponse.read()
to fixpydoc
output.
测试
gh-102980 [https://github.com/python/cpython/issues/102980]: Improve test coverage on
pdb
.gh-102537 [https://github.com/python/cpython/issues/102537]: Adjust the error handling strategy in
test_zoneinfo.TzPathTest.python_tzpath_context
. Patch by Paul Ganssle.gh-101377 [https://github.com/python/cpython/issues/101377]: Improved test_locale_calendar_formatweekday of calendar.
构建
gh-102973 [https://github.com/python/cpython/issues/102973]: Add a dev container (along with accompanying Dockerfile) for development purposes.
gh-102711 [https://github.com/python/cpython/issues/102711]: Fix
-Wstrict-prototypes
compiler warnings.
Windows
gh-102690 [https://github.com/python/cpython/issues/102690]: Update
webbrowser
to fall back to Microsoft Edge instead of Internet Explorer.gh-99726 [https://github.com/python/cpython/issues/99726]: Improves correctness of stat results for Windows, and uses faster API when available
工具/示例
- gh-102809 [https://github.com/python/cpython/issues/102809]:
Misc/gdbinit
was removed.
C API
- gh-102013 [https://github.com/python/cpython/issues/102013]: Add a new (unstable) C-API function for iterating over GC'able objects using a callback:
PyUnstable_VisitObjects
.
Python 3.12.0 alpha 6
Release date: 2023-03-07
安全性
gh-99108 [https://github.com/python/cpython/issues/99108]: Replace builtin hashlib implementations of MD5 and SHA1 with verified ones from the HACL* project.
gh-101727 [https://github.com/python/cpython/issues/101727]: Updated the OpenSSL version used in Windows and macOS binary release builds to 1.1.1t to address CVE 2023-0286 [https://www.cve.org/CVERecord?id=CVE-2023-0286], CVE 2022-4303 [https://www.cve.org/CVERecord?id=CVE-2022-4303], and CVE 2022-4303 [https://www.cve.org/CVERecord?id=CVE-2022-4303] per the OpenSSL 2023-02-07 security advisory [https://openssl-library.org/news/secadv/20230207.txt].
gh-99108 [https://github.com/python/cpython/issues/99108]: Replace the builtin
hashlib
implementations of SHA2-384 and SHA2-512 originally from LibTomCrypt with formally verified, side-channel resistant code from the HACL* [https://github.com/hacl-star/hacl-star/] project. The builtins remain a fallback only used when OpenSSL does not provide them.gh-101283 [https://github.com/python/cpython/issues/101283]:
subprocess.Popen
now uses a safer approach to findcmd.exe
when launching withshell=True
. Patch by Eryk Sun, based on a patch by Oleg Iarygin.
核心与内置函数
gh-102493 [https://github.com/python/cpython/issues/102493]: Fix regression in semantics of normalisation in
PyErr_SetObject
.gh-102416 [https://github.com/python/cpython/issues/102416]: Do not memoize incorrectly automatically generated loop rules in the parser. Patch by Pablo Galindo.
gh-102356 [https://github.com/python/cpython/issues/102356]: Fix a bug that caused a crash when deallocating deeply nested filter objects. Patch by Marta Gómez Macías.
gh-102336 [https://github.com/python/cpython/issues/102336]: Cleanup Windows 7 specific special handling. Patch by Max Bachmann.
gh-102250 [https://github.com/python/cpython/issues/102250]: Fixed a segfault occurring when the interpreter calls a
__bool__
method that raises.gh-102126 [https://github.com/python/cpython/issues/102126]: Fix deadlock at shutdown when clearing thread states if any finalizer tries to acquire the runtime head lock. Patch by Kumar Aditya.
gh-102027 [https://github.com/python/cpython/issues/102027]: Use
GetCurrentProcessId
on Windows whengetpid
is unavailable. Patch by Max Bachmann.gh-102056 [https://github.com/python/cpython/issues/102056]: Fix error handling bugs in interpreter's exception printing code, which could cause a crash on infinite recursion.
gh-100982 [https://github.com/python/cpython/issues/100982]: Restrict the scope of the
FOR_ITER_RANGE
instruction to the scope of the originalFOR_ITER
instruction, to allow instrumentation.gh-101967 [https://github.com/python/cpython/issues/101967]: Fix possible segfault in
positional_only_passedaskeyword
function, when new list created.gh-101952 [https://github.com/python/cpython/issues/101952]: Fix possible segfault in
BUILD_SET
opcode, when new set created.gh-74895 [https://github.com/python/cpython/issues/74895]:
socket.getaddrinfo
no longer raisesOverflowError
forint
port values outside of the C long range. Out of range values are left up to the underlying string based C library API to report. Asocket.gaierror
SAI_SERVICE
may occur instead, or no error at all as not all platform C libraries generate an error.gh-101799 [https://github.com/python/cpython/issues/101799]: Add
CALL_INTRINSIC_2
and use it instead ofPREP_RERAISE_STAR
.gh-101857 [https://github.com/python/cpython/issues/101857]: Fix xattr support detection on Linux systems by widening the check to linux, not just glibc. This fixes support for musl.
gh-84783 [https://github.com/python/cpython/issues/84783]: Make the slice object hashable. Patch by Will Bradshaw and Furkan Onder.
gh-87849 [https://github.com/python/cpython/issues/87849]: Change the
SEND
instruction to leave the receiver on the stack. This allows the specialized form ofSEND
to skip the chain of C calls and jump directly to theRESUME
in the generator or coroutine.gh-101765 [https://github.com/python/cpython/issues/101765]: Fix SystemError / segmentation fault in iter
__reduce__
when internal access ofbuiltins.__dict__
keys mutates the iter object.gh-101430 [https://github.com/python/cpython/issues/101430]: Update
tracemalloc
to handle presize of object properly. Patch by Donghee Na.gh-101696 [https://github.com/python/cpython/issues/101696]: Invalidate type version tag in
PyStaticTypeDealloc
for static types, avoiding bug where a false cache hit could crash the interpreter. Patch by Kumar Aditya.gh-101632 [https://github.com/python/cpython/issues/101632]: Adds a new
RETURN_CONST
instruction.gh-100719 [https://github.com/python/cpython/issues/100719]: Remove gi_code field from generator (and coroutine and async generator) objects as it is redundant. The frame already includes a reference to the code object.
gh-98627 [https://github.com/python/cpython/issues/98627]: When an interpreter is configured to check (and only then), importing an extension module will now fail when the extension does not support multiple interpreters (i.e. doesn't implement PEP 489 multiphase init). This does not apply to the main interpreter, nor to subinterpreters created with
Py_NewInterpreter()
.
库
gh-102302 [https://github.com/python/cpython/issues/102302]: Micro-optimise hashing of
inspect.Parameter
, reducing the time it takes to hash an instance by around 40%.gh-101979 [https://github.com/python/cpython/issues/101979]: Fix a bug where parentheses in the
metavar
argument toargparse.ArgumentParser.add_argument()
were dropped. Patch by Yeojin Kim.gh-91038 [https://github.com/python/cpython/issues/91038]:
platform.platform()
now has boolean default arguments.gh-81652 [https://github.com/python/cpython/issues/81652]: Add
mmap.MAP_ALIGNED_SUPER
FreeBSD andmmap.MAP_CONCEAL
OpenBSD constants tommap
. Patch by Yeojin Kim.gh-102179 [https://github.com/python/cpython/issues/102179]: Fix
os.dup2()
error message for negative fds.gh-101961 [https://github.com/python/cpython/issues/101961]: For the binary mode,
fileinput.hookcompressed()
doesn't set theencoding
value even if the value isNone
. Patch by Gihwan Kim.gh-101936 [https://github.com/python/cpython/issues/101936]: The default value of
fp
becomesio.BytesIO
ifHTTPError
is initialized without a designatedfp
parameter. Patch by Long Vo.gh-101566 [https://github.com/python/cpython/issues/101566]: In zipfile, sync Path with zipp 3.14 [https://zipp.readthedocs.io/en/latest/history.html#v3-14-0], including fix for extractall on the underlying zipfile after being wrapped in
Path
.gh-97930 [https://github.com/python/cpython/issues/97930]: Apply changes from importlib_resources 5.12 [https://importlib-resources.readthedocs.io/en/latest/history.html#v5-12-0], including fix for
MultiplexedPath
to support directories in multiple namespaces (python/importlib_resources#265).gh-101997 [https://github.com/python/cpython/issues/101997]: Upgrade pip wheel bundled with ensurepip (pip 23.0.1)
gh-99108 [https://github.com/python/cpython/issues/99108]: The builtin extension modules for
hashlib
SHA2 algorithms, used when OpenSSL does not provide them, now live in a single internal_sha2
module instead of separate_sha256
and_sha512
modules.gh-101892 [https://github.com/python/cpython/issues/101892]: Callable iterators no longer raise
SystemError
when the callable object exhausts the iterator but forgets to either return a sentinel value or raiseStopIteration
.gh-87634 [https://github.com/python/cpython/issues/87634]: Remove locking behavior from
functools.cached_property()
.gh-97786 [https://github.com/python/cpython/issues/97786]: Fix potential undefined behaviour in corner cases of floating-point-to-time conversions.
gh-101517 [https://github.com/python/cpython/issues/101517]: Fixed bug where
bdb
looks up the source line withlinecache
with alineno=None
, which causes it to fail with an unhandled exception.gh-101773 [https://github.com/python/cpython/issues/101773]: Optimize
fractions.Fraction
for small components. The private argument_normalize
of thefractions.Fraction
constructor has been removed.gh-101693 [https://github.com/python/cpython/issues/101693]: In
sqlite3.Cursor.execute()
,DeprecationWarning
is now emitted when named placeholders are used together with parameters supplied as a sequence instead of as adict
. Starting from Python 3.14, using named placeholders with parameters supplied as a sequence will raise aProgrammingError
. Patch by Erlend E. Aasland.gh-101446 [https://github.com/python/cpython/issues/101446]: Change repr of
collections.OrderedDict
to use regular dictionary formatting instead of pairs of keys and values.gh-101362 [https://github.com/python/cpython/issues/101362]: Speed up
pathlib.PurePath
construction by handling arguments more uniformly. When apathlib.Path
argument is supplied, we use its string representation rather than joining its parts withos.path.join()
.gh-101362 [https://github.com/python/cpython/issues/101362]: Speed up
pathlib.PurePath
construction by callingos.path.join()
only when two or more arguments are given.gh-101362 [https://github.com/python/cpython/issues/101362]: Speed up
pathlib.Path
construction by running the path flavour compatibility check only when pathlib is imported.gh-85984 [https://github.com/python/cpython/issues/85984]: Refactored the implementation of
pty.fork()
to useos.login_tty()
.
A DeprecationWarning
is now raised by pty.master_open()
and pty.slave_open()
. They were undocumented and deprecated long long ago in the docstring in favor of pty.openpty()
.
gh-101561 [https://github.com/python/cpython/issues/101561]: Add a new decorator
typing.override()
. See PEP 698 [https://peps.python.org/pep-0698/] for details. Patch by Steven Troxler.gh-63301 [https://github.com/python/cpython/issues/63301]: Set exit code when
tabnanny
CLI exits on error.gh-101360 [https://github.com/python/cpython/issues/101360]: Fix anchor matching in
pathlib.PureWindowsPath.match()
. Path and pattern anchors are now matched withfnmatch
, just like other path parts. This allows patterns such as":/Users/"
to be matched.gh-101277 [https://github.com/python/cpython/issues/101277]: Remove global state from
itertools
module ( PEP 687 [https://peps.python.org/pep-0687/]). Patches by Erlend E. Aasland.gh-100809 [https://github.com/python/cpython/issues/100809]: Fix handling of drive-relative paths (like 'C:' and 'C:foo') in
pathlib.Path.absolute()
. This method now uses the OS API to retrieve the correct current working directory for the drive.gh-99138 [https://github.com/python/cpython/issues/99138]: Apply PEP 687 [https://peps.python.org/pep-0687/] to
zoneinfo
. Patch by Erlend E. Aasland.gh-96764 [https://github.com/python/cpython/issues/96764]:
asyncio.wait_for()
now usesasyncio.timeout()
as its underlying implementation. Patch by Kumar Aditya.gh-88233 [https://github.com/python/cpython/issues/88233]: Correctly preserve "extra" fields in
zipfile
regardless of their ordering relative to a zip64 "extra."bpo-23224 [https://bugs.python.org/issue?@action=redirect&bpo=23224]: Fix segfaults when creating
lzma.LZMADecompressor
andbz2.BZ2Decompressor
objects without calling__init__()
, and fix leakage of locks and internal buffers when calling the__init__()
methods oflzma.LZMADecompressor
,lzma.LZMACompressor
,bz2.BZ2Compressor
, andbz2.BZ2Decompressor
objects multiple times.
文档
gh-85417 [https://github.com/python/cpython/issues/85417]: Update
cmath
documentation to clarify behaviour on branch cuts.gh-97725 [https://github.com/python/cpython/issues/97725]: Fix
asyncio.Task.print_stack()
description forfile=None
. Patch by Oleg Iarygin.
测试
gh-102019 [https://github.com/python/cpython/issues/102019]: Fix deadlock on shutdown if
test_current_{exception,frames}
fails. Patch by Jacob Bower.gh-85984 [https://github.com/python/cpython/issues/85984]: Utilize new "winsize" functions from termios in pty tests.
gh-89792 [https://github.com/python/cpython/issues/89792]:
test_tools
now copies up to 10x less source data to a temporary directory during thefreeze
test by ignoring git metadata and other artifacts. It also limits its python build parallelism based on os.cpu_count instead of hard coding it as 8 cores.
构建
gh-99942 [https://github.com/python/cpython/issues/99942]: On Android, in a static build, python-config in embed mode no longer incorrectly reports a library to link to.
gh-99942 [https://github.com/python/cpython/issues/99942]: On Android, python.pc now correctly reports the library to link to, the same as python-config.sh.
gh-100221 [https://github.com/python/cpython/issues/100221]: Fix creating install directories in
make sharedinstall
if they exist outsideDESTDIR
already.gh-96821 [https://github.com/python/cpython/issues/96821]: Explicitly mark C extension modules that need defined signed integer overflow, and add a configure option
--with-strict-overflow
. Patch by Matthias Görgens and Shantanu Jain.
Windows
gh-102344 [https://github.com/python/cpython/issues/102344]: Implement
winreg.QueryValue
usingQueryValueEx
andwinreg.SetValue
usingSetValueEx
. Patch by Max Bachmann.gh-101881 [https://github.com/python/cpython/issues/101881]: Handle read and write operations on nonblocking pipes properly on Windows.
gh-101881 [https://github.com/python/cpython/issues/101881]: Add support for the os.get_blocking() and os.set_blocking() functions on Windows.
gh-101849 [https://github.com/python/cpython/issues/101849]: Ensures installer will correctly upgrade existing
py.exe
launcher installs.gh-101763 [https://github.com/python/cpython/issues/101763]: Updates copy of libffi bundled with Windows installs to 3.4.4.
gh-101759 [https://github.com/python/cpython/issues/101759]: Update Windows installer to SQLite 3.40.1.
gh-101614 [https://github.com/python/cpython/issues/101614]: Correctly handle extensions built against debug binaries that reference
python3_d.dll
.gh-101196 [https://github.com/python/cpython/issues/101196]: The functions
os.path.isdir
,os.path.isfile
,os.path.islink
andos.path.exists
are now 13% to 28% faster on Windows, by making fewer Win32 API calls.
macOS
- gh-101759 [https://github.com/python/cpython/issues/101759]: Update macOS installer to SQLite 3.40.1.
C API
gh-101907 [https://github.com/python/cpython/issues/101907]: Removes use of non-standard C++ extension in public header files.
gh-99293 [https://github.com/python/cpython/issues/99293]: Document that the Py_TPFLAGS_VALID_VERSION_TAG is an internal feature, should not be used, and will be removed.
gh-101578 [https://github.com/python/cpython/issues/101578]: Add
PyErr_GetRaisedException()
andPyErr_SetRaisedException()
for saving and restoring the current exception. These functions return and accept a single exception object, rather than the triple arguments of the now-deprecatedPyErr_Fetch()
andPyErr_Restore()
. This is less error prone and a bit more efficient.
Add PyException_GetArgs()
and PyException_SetArgs()
as convenience functions for retrieving and modifying the args
passed to the exception's constructor.
- gh-91744 [https://github.com/python/cpython/issues/91744]: Introduced the Unstable C API tier, marking APi that is allowed to change in minor releases without a deprecation period. See PEP 689 [https://peps.python.org/pep-0689/] for details.
Python 3.12.0 alpha 5
Release date: 2023-02-07
安全性
- gh-99108 [https://github.com/python/cpython/issues/99108]: Replace the builtin
hashlib
implementations of SHA2-224 and SHA2-256 originally from LibTomCrypt with formally verified, side-channel resistant code from the HACL* [https://github.com/hacl-star/hacl-star/] project. The builtins remain a fallback only used when OpenSSL does not provide them.
核心与内置函数
gh-92173 [https://github.com/python/cpython/issues/92173]: Fix the
defs
andkwdefs
arguments toPyEval_EvalCodeEx()
and a reference leak in that function.gh-59956 [https://github.com/python/cpython/issues/59956]: The GILState API is now partially compatible with subinterpreters. Previously,
PyThreadState_GET()
andPyGILState_GetThisThreadState()
would get out of sync, causing inconsistent behavior and crashes.gh-101400 [https://github.com/python/cpython/issues/101400]: Fix wrong lineno in exception message on
continue
orbreak
which are not in a loop. Patch by Donghee Na.gh-101372 [https://github.com/python/cpython/issues/101372]: Fix
is_normalized()
to properly handle the UCD 3.2.0 cases. Patch by Donghee Na.gh-101266 [https://github.com/python/cpython/issues/101266]: Fix
sys.getsizeof()
reporting forint
subclasses.gh-101291 [https://github.com/python/cpython/issues/101291]: Refactor the
PyLongObject
struct into a normal Python object header and aPyLongValue
struct.gh-101046 [https://github.com/python/cpython/issues/101046]: Fix a possible memory leak in the parser when raising
MemoryError
. Patch by Pablo Galindogh-101037 [https://github.com/python/cpython/issues/101037]: Fix potential memory underallocation issue for instances of
int
subclasses with value zero.gh-100762 [https://github.com/python/cpython/issues/100762]: Record the (virtual) exception block depth in the oparg of
YIELD_VALUE
. Use this to avoid the expensivethrow()
when closing generators (and coroutines) that can be closed trivially.gh-100982 [https://github.com/python/cpython/issues/100982]: Adds a new
COMPARE_AND_BRANCH
instruction. This is a bit more efficient when performing a comparison immediately followed by a branch, and restores the design intent of PEP 659 that specializations are local to a single instruction.gh-100942 [https://github.com/python/cpython/issues/100942]: Fixed segfault in property.getter/setter/deleter that occurred when a property subclass overrode the
_new_
method to return a non-property instance.gh-100923 [https://github.com/python/cpython/issues/100923]: Remove the
mask
cache entry for theCOMPARE_OP
instruction and embed the mask into the oparg.gh-100892 [https://github.com/python/cpython/issues/100892]: Fix race while iterating over thread states in clearing
threading.local
. Patch by Kumar Aditya.gh-91351 [https://github.com/python/cpython/issues/91351]: Fix a case where reentrant imports could corrupt the import deadlock detection code and cause a
KeyError
to be raised out ofimportlib/_bootstrap
. In addition to the straightforward cases, this could also happen when garbage collection leads to a warning being emitted — as happens when it collects an open socket or file)gh-100726 [https://github.com/python/cpython/issues/100726]: Optimize construction of
range
object for medium size integers.gh-100712 [https://github.com/python/cpython/issues/100712]: Added option to build cpython with specialization disabled, by setting
ENABLE_SPECIALIZATION=False
inopcode
, followed bymake regen-all
.bpo-32780 [https://bugs.python.org/issue?@action=redirect&bpo=32780]: Inter-field padding is now inserted into the PEP3118 format strings obtained from
ctypes.Structure
objects, reflecting their true representation in memory.
库
gh-101541 [https://github.com/python/cpython/issues/101541]: [Enum] - fix psuedo-flag creation
gh-101570 [https://github.com/python/cpython/issues/101570]: Upgrade pip wheel bundled with ensurepip (pip 23.0)
gh-101323 [https://github.com/python/cpython/issues/101323]: Fix a bug where errors where not thrown by zlib._ZlibDecompressor if encountered during decompressing.
gh-101317 [https://github.com/python/cpython/issues/101317]: Add ssl_shutdown_timeout parameter for
asyncio.StreamWriter.start_tls()
.gh-101326 [https://github.com/python/cpython/issues/101326]: Fix regression when passing
None
as second or third argument toFutureIter.throw
.gh-92123 [https://github.com/python/cpython/issues/92123]: Adapt the
_elementtree
extension module to multiphase init ( PEP 489 [https://peps.python.org/pep-0489/]). Patches by Erlend E. Aasland.gh-100795 [https://github.com/python/cpython/issues/100795]: Avoid potential unexpected
freeaddrinfo
call (double free) insocket
when when a libcgetaddrinfo()
implementation leaves garbage in an output pointer when returning an error. Original patch by Sergey G. Brester.gh-101143 [https://github.com/python/cpython/issues/101143]: Remove unused references to
TimerHandle
inasyncio.base_events.BaseEventLoop._add_callback
.gh-101144 [https://github.com/python/cpython/issues/101144]: Make
zipfile.Path.open()
andzipfile.Path.read_text()
also acceptencoding
as a positional argument. This was the behavior in Python 3.9 and earlier. 3.10 introduced a regression where supplying it as a positional argument would lead to aTypeError
.gh-94518 [https://github.com/python/cpython/issues/94518]: Group-related variables of
_posixsubprocess
module are renamed to stress that supplementary group affinity is added to a fork, not replace the inherited ones. Patch by Oleg Iarygin.gh-101015 [https://github.com/python/cpython/issues/101015]: Fix
typing.get_type_hints()
on'*tuple[…]'
and*tuple[…]
. It must not drop theUnpack
part.gh-101000 [https://github.com/python/cpython/issues/101000]: Add
os.path.splitroot()
, which splits a path into a 3-item tuple(drive, root, tail)
. This new function is used bypathlib
to improve the performance of path construction by up to a third.gh-100573 [https://github.com/python/cpython/issues/100573]: Fix a Windows
asyncio
bug with named pipes where a client doingos.stat()
on the pipe would cause an error in the server that disabled serving future requests.gh-39615 [https://github.com/python/cpython/issues/39615]:
warnings.warn()
now has the ability to skip stack frames based on code filename prefix rather than only a numericstacklevel
via the newskip_file_prefixes
keyword argument.gh-100750 [https://github.com/python/cpython/issues/100750]: pass encoding kwarg to subprocess in platform
gh-100160 [https://github.com/python/cpython/issues/100160]: Emit a deprecation warning in
asyncio.DefaultEventLoopPolicy.get_event_loop()
if there is no current event loop set and it decides to create one.gh-96290 [https://github.com/python/cpython/issues/96290]: Fix handling of partial and invalid UNC drives in
ntpath.splitdrive()
, and inntpath.normpath()
on non-Windows systems. Paths such as '\server' and '\' are now considered bysplitdrive()
to contain only a drive, and consequently are not modified bynormpath()
on non-Windows systems. The behaviour ofnormpath()
on Windows systems is unaffected, as native OS APIs are used. Patch by Eryk Sun, with contributions by Barney Gale.gh-99952 [https://github.com/python/cpython/issues/99952]: Fix a reference undercounting issue in
ctypes.Structure
withfrom_param()
results larger than a C pointer.gh-67790 [https://github.com/python/cpython/issues/67790]: Add float-style formatting support for
fractions.Fraction
instances.gh-99266 [https://github.com/python/cpython/issues/99266]: Preserve more detailed error messages in
ctypes
.gh-86682 [https://github.com/python/cpython/issues/86682]: Ensure runtime-created collections have the correct module name using the newly added (internal)
sys._getframemodulename()
.gh-88597 [https://github.com/python/cpython/issues/88597]:
uuid
now has a command line interface. Trypython -m uuid -h
.gh-60580 [https://github.com/python/cpython/issues/60580]:
ctypes.wintypes.BYTE
definition changed fromc_byte
toc_ubyte
to match Windows SDK. Patch by Anatoly Techtonik and Oleg Iarygin.gh-94518 [https://github.com/python/cpython/issues/94518]:
_posixsubprocess
now initializes all UID and GID variables using a reserved-1
value instead of a separate flag. Patch by Oleg Iarygin.bpo-38941 [https://bugs.python.org/issue?@action=redirect&bpo=38941]: The
xml.etree.ElementTree
module now emitsDeprecationWarning
when testing the truth value of anxml.etree.ElementTree.Element
. Before, the Python implementation emittedFutureWarning
, and the C implementation emitted nothing.bpo-40077 [https://bugs.python.org/issue?@action=redirect&bpo=40077]: Convert
elementtree
types to heap types. Patch by Erlend E. Aasland.bpo-29847 [https://bugs.python.org/issue?@action=redirect&bpo=29847]: Fix a bug where
pathlib.Path
accepted and ignored keyword arguments. Patch provided by Yurii Karabas.gh-77772 [https://github.com/python/cpython/issues/77772]:
ctypes.CDLL
,ctypes.OleDLL
,ctypes.WinDLL
, andctypes.PyDLL
now accept pathlike objects as theirname
argument. Patch by Robert Hoelzl.
文档
- gh-88324 [https://github.com/python/cpython/issues/88324]: Reword
subprocess
to emphasize default behavior of stdin, stdout, and stderr arguments. Remove inaccurate statement about child file handle inheritance.
测试
- gh-101334 [https://github.com/python/cpython/issues/101334]:
test_tarfile
has been updated to pass when run as a high UID.
构建
gh-101282 [https://github.com/python/cpython/issues/101282]: Update BOLT configuration not to use deprecated usage of
--split functions
. Patch by Donghee Na.gh-101522 [https://github.com/python/cpython/issues/101522]: Allow overriding Windows dependencies versions and paths using MSBuild properties.
gh-77532 [https://github.com/python/cpython/issues/77532]: Minor fixes to allow building with
PlatformToolset=ClangCL
on Windows.gh-101152 [https://github.com/python/cpython/issues/101152]: In accordance with PEP 699 [https://peps.python.org/pep-0699/], the
ma_version_tag
field inPyDictObject
is deprecated for extension modules. Accessing this field will generate a compiler warning at compile time. This field will be removed in Python 3.14.gh-100340 [https://github.com/python/cpython/issues/100340]: Allows -Wno-int-conversion for wasm-sdk 17 and onwards, thus enables building WASI builds once against the latest sdk.
gh-101060 [https://github.com/python/cpython/issues/101060]: Conditionally add
-fno-reorder-blocks-and-partition
in configure. Effectively fixes--enable-bolt
when using Clang, as this appears to be a GCC-only flag.gh-98705 [https://github.com/python/cpython/issues/98705]:
__bool__
is defined in AIX system header files which breaks the build in AIX, so undefine it.gh-98636 [https://github.com/python/cpython/issues/98636]: Fix a regression in detecting
gdbm_compat
library for the_gdbm
module build.gh-96305 [https://github.com/python/cpython/issues/96305]:
aixsupport
now uses a simple code to get platform details rather than the now nonexistent_bootsubprocess
during bootstrap.
Windows
gh-101543 [https://github.com/python/cpython/issues/101543]: Ensure the install path in the registry is only used when the standard library hasn't been located in any other way.
gh-101467 [https://github.com/python/cpython/issues/101467]: The
py.exe
launcher now correctly filters when only a single runtime is installed. It also correctly handles prefix matches on tags so that-3.1
does not match3.11
, but would still match3.1-32
.gh-99834 [https://github.com/python/cpython/issues/99834]: Updates bundled copy of Tcl/Tk to 8.6.13.0
gh-101135 [https://github.com/python/cpython/issues/101135]: Restore ability to launch older 32-bit versions from the
py.exe
launcher when both 32-bit and 64-bit installs of the same version are available.gh-82052 [https://github.com/python/cpython/issues/82052]: Fixed an issue where writing more than 32K of Unicode output to the console screen in one go can result in mojibake.
gh-100320 [https://github.com/python/cpython/issues/100320]: Ensures the
PythonPath
registry key from an install is used when launching from a different copy of Python that relies on an existing install to provide a copy of its modules and standard library.gh-100247 [https://github.com/python/cpython/issues/100247]: Restores support for the
py.exe
launcher finding shebang commands in its configuration file using the full command name.
Python 3.12.0 alpha 4
Release date: 2023-01-10
核心与内置函数
gh-100776 [https://github.com/python/cpython/issues/100776]: Fix misleading default value in
input()
's__textsignature_
.gh-99005 [https://github.com/python/cpython/issues/99005]: Remove
UNARY_POSITIVE
,ASYNC_GEN_WRAP
andLIST_TO_TUPLE
, replacing them with intrinsics.gh-99005 [https://github.com/python/cpython/issues/99005]: Add new
CALL_INTRINSIC_1
instruction. RemoveIMPORT_STAR
,PRINT_EXPR
andSTOPITERATION_ERROR
, replacing them with theCALL_INTRINSIC_1
instruction.gh-100288 [https://github.com/python/cpython/issues/100288]: Remove the LOAD_ATTR_METHOD_WITH_DICT specialized instruction. Stats show it is not useful.
gh-100720 [https://github.com/python/cpython/issues/100720]: Added
PyFrameNumSlotsForCodeObject
, which returns the number of slots needed in a frame for a given code object.gh-100719 [https://github.com/python/cpython/issues/100719]: Removed the co_nplaincellvars field from the code object, as it is redundant.
gh-100637 [https://github.com/python/cpython/issues/100637]: Fix
int.__sizeof__()
calculation to include the 1-elementob_digit
array for0
andFalse
.gh-100649 [https://github.com/python/cpython/issues/100649]: Update the native_thread_id field of PyThreadState after fork.
gh-100126 [https://github.com/python/cpython/issues/100126]: Fix an issue where "incomplete" frames could be briefly visible to C code while other frames are being torn down, possibly resulting in corruption or hard crashes of the interpreter while running finalizers.
gh-87447 [https://github.com/python/cpython/issues/87447]: Fix
SyntaxError
on comprehension rebind checking with names that are not actually redefined.
Now reassigning b
in [(b := 1) for a, b.prop in some_iter]
is allowed. Reassigning a
is still disallowed as per PEP 572 [https://peps.python.org/pep-0572/].
gh-100268 [https://github.com/python/cpython/issues/100268]: Add
int.is_integer()
to improve duck type compatibility betweenint
andfloat
.gh-100425 [https://github.com/python/cpython/issues/100425]: Improve the accuracy of
sum()
with compensated summation.gh-100374 [https://github.com/python/cpython/issues/100374]: Fix incorrect result and delay in
socket.getfqdn()
. Patch by Dominic Socular.gh-100357 [https://github.com/python/cpython/issues/100357]: Convert
vars
,dir
,next
,getattr
, anditer
to argument clinic.gh-100117 [https://github.com/python/cpython/issues/100117]: Improve the output of
codeobject.co_lines()
by emitting only one entry for each line range.gh-90043 [https://github.com/python/cpython/issues/90043]: Handle NaNs when specializing
COMPARE_OP
forfloat
values.gh-100222 [https://github.com/python/cpython/issues/100222]: Redefine the
PyCODEUNIT
typedef as a union to describe its layout to the C compiler, avoiding type punning and improving clarity.gh-99955 [https://github.com/python/cpython/issues/99955]: Internal compiler functions (in compile.c) now consistently return -1 on error and 0 on success.
gh-100188 [https://github.com/python/cpython/issues/100188]: The
BINARY_SUBSCR_LIST_INT
andBINARY_SUBSCR_TUPLE_INT
instructions are no longer used for negative integers because those instructions always miss when encountering negative integers.gh-99110 [https://github.com/python/cpython/issues/99110]: Initialize frame->previous in frameobject.c to fix a segmentation fault when accessing frames created by
PyFrame_New()
.gh-94155 [https://github.com/python/cpython/issues/94155]: Improved the hashing algorithm for code objects, mitigating some hash collisions.
gh-99540 [https://github.com/python/cpython/issues/99540]:
None
now hashes to a constant value. This is not a requirements change.gh-100143 [https://github.com/python/cpython/issues/100143]: When built with
--enable-pystats
, stats collection is now off by default. To enable it early at startup, pass the-Xpystats
flag. Stats are now always dumped, even if switched off.gh-100146 [https://github.com/python/cpython/issues/100146]: Improve
BUILD_LIST
opcode so that it works similarly to theBUILD_TUPLE
opcode, by stealing references from the stack rather than repeatedly using stack operations to set list elements. Implementation details are in a new private APIPyListFromArraySteal()
.gh-100110 [https://github.com/python/cpython/issues/100110]: Specialize
FOR_ITER
for tuples.gh-100050 [https://github.com/python/cpython/issues/100050]: Honor existing errors obtained when searching for mismatching parentheses in the tokenizer. Patch by Pablo Galindo
gh-92216 [https://github.com/python/cpython/issues/92216]: Improve the performance of
hasattr()
for type objects with a missing attribute.gh-99582 [https://github.com/python/cpython/issues/99582]: Freeze
zipimport
module intobootstrappython
.gh-99554 [https://github.com/python/cpython/issues/99554]: Pack debugging location tables more efficiently during bytecode compilation.
gh-98522 [https://github.com/python/cpython/issues/98522]: Add an internal version number to code objects, to give better versioning of inner functions and comprehensions, and thus better specialization of those functions. This change is invisible to both Python and C extensions.
gh-94603 [https://github.com/python/cpython/issues/94603]: Improve performance of
list.pop
for small lists.gh-89051 [https://github.com/python/cpython/issues/89051]: Add
ssl.OP_LEGACY_SERVER_CONNECT
bpo-32782 [https://bugs.python.org/issue?@action=redirect&bpo=32782]:
ctypes
arrays of length 0 now report a correct itemsize when amemoryview
is constructed from them, rather than always giving a value of 0.
库
gh-100833 [https://github.com/python/cpython/issues/100833]: Speed up
math.fsum()
by removing defensivevolatile
qualifiers.gh-100805 [https://github.com/python/cpython/issues/100805]: Modify
random.choice()
implementation to once again work with NumPy arrays.gh-100813 [https://github.com/python/cpython/issues/100813]: Add
socket.IP_PKTINFO
constant.gh-100792 [https://github.com/python/cpython/issues/100792]: Make
email.message.Message.__contains__()
twice as fast.gh-91851 [https://github.com/python/cpython/issues/91851]: Microoptimizations for
fractions.Fraction.__round__()
,fractions.Fraction.__ceil__()
andfractions.Fraction.__floor__()
.gh-90104 [https://github.com/python/cpython/issues/90104]: Avoid RecursionError on
repr
if a dataclass field definition has a cyclic reference.gh-100689 [https://github.com/python/cpython/issues/100689]: Fix crash in
pyexpat
by statically allocatingPyExpat_CAPI
capsule.gh-100740 [https://github.com/python/cpython/issues/100740]: Fix
unittest.mock.Mock
not respecting the spec for attribute names prefixed withassert
.gh-91219 [https://github.com/python/cpython/issues/91219]: Change
SimpleHTTPRequestHandler
to support subclassing to provide a different set of index file names instead of using__init__
parameters.gh-100690 [https://github.com/python/cpython/issues/100690]:
Mock
objects which are not unsafe will now raise anAttributeError
when accessing an attribute that matches the name of an assertion but without the prefixassert_
, e.g. accessingcalled_once
instead ofassert_called_once
. This is in addition to this already happening for accessing attributes with prefixesassert
,assret
,asert
,aseert
, andassrt
.gh-89727 [https://github.com/python/cpython/issues/89727]: Simplify and optimize
os.walk()
by usingisinstance()
checks to check the top of the stack.gh-100485 [https://github.com/python/cpython/issues/100485]: Add math.sumprod() to compute the sum of products.
gh-86508 [https://github.com/python/cpython/issues/86508]: Fix
asyncio.open_connection()
to skip binding to local addresses of different family. Patch by Kumar Aditya.gh-97930 [https://github.com/python/cpython/issues/97930]:
importlib.resources.files
now accepts a module as an anchor instead of only accepting packages. If a module is passed, resources are resolved adjacent to that module (in the same package or at the package root). The parameter was renamed frompackage
toanchor
with a compatibility shim for those passing by keyword. Additionally, the newanchor
parameter is now optional and will default to the caller's module.gh-100585 [https://github.com/python/cpython/issues/100585]: Fixed a bug where importlib.resources.as_file was leaving file pointers open
gh-100562 [https://github.com/python/cpython/issues/100562]: Improve performance of
pathlib.Path.absolute()
by nearly 2x. This comes at the cost of a performance regression inpathlib.Path.cwd()
, which is generally used less frequently in user code.gh-100519 [https://github.com/python/cpython/issues/100519]: Small simplification of
http.cookiejar.eff_request_host()
that improves readability and better matches the RFC wording.gh-100287 [https://github.com/python/cpython/issues/100287]: Fix the interaction of
unittest.mock.seal()
withunittest.mock.AsyncMock
.gh-100488 [https://github.com/python/cpython/issues/100488]: Add
Fraction.is_integer()
to check whether afractions.Fraction
is an integer. This improves duck type compatibility withfloat
andint
.gh-100474 [https://github.com/python/cpython/issues/100474]:
http.server
now checks that an index page is actually a regular file before trying to serve it. This avoids issues with directories namedindex.html
.gh-100363 [https://github.com/python/cpython/issues/100363]: Speed up
asyncio.get_running_loop()
by removing redundantgetpid
checks. Patch by Kumar Aditya.gh-78878 [https://github.com/python/cpython/issues/78878]: Fix crash when creating an instance of
_ctypes.CField
.gh-100348 [https://github.com/python/cpython/issues/100348]: Fix ref cycle in
asyncio._SelectorSocketTransport
by removingreadready_cb
inclose
.gh-100344 [https://github.com/python/cpython/issues/100344]: Provide C implementation for
asyncio.current_task()
for a 4x-6x speedup.gh-100272 [https://github.com/python/cpython/issues/100272]: Fix JSON serialization of OrderedDict. It now preserves the order of keys.
gh-83076 [https://github.com/python/cpython/issues/83076]: Instantiation of
Mock()
andAsyncMock()
is now 3.8x faster.gh-100234 [https://github.com/python/cpython/issues/100234]: Set a default value of 1.0 for the
lambd
parameter in random.expovariate().gh-100228 [https://github.com/python/cpython/issues/100228]: A
DeprecationWarning
may be raised whenos.fork()
oros.forkpty()
is called from multithreaded processes. Forking with threads is unsafe and can cause deadlocks, crashes and subtle problems. Lack of a warning does not indicate that the fork call was actually safe, as Python may not be aware of all threads.gh-100039 [https://github.com/python/cpython/issues/100039]: Improve signatures for enums and flags.
gh-100133 [https://github.com/python/cpython/issues/100133]: Fix regression in
asyncio
where a subprocess would sometimes lose data received from pipe.bpo-44592 [https://bugs.python.org/issue?@action=redirect&bpo=44592]: Fixes inconsistent handling of case sensitivity of extrasaction arg in
csv.DictWriter
.gh-100098 [https://github.com/python/cpython/issues/100098]: Fix
tuple
subclasses being cast totuple
when used as enum values.gh-85432 [https://github.com/python/cpython/issues/85432]: Rename the fmt parameter of the pure-Python implementation of
datetime.time.strftime()
to format. Rename the t parameter ofdatetime.datetime.fromtimestamp()
to timestamp. These changes mean the parameter names in the pure-Python implementation now match the parameter names in the C implementation. Patch by Alex Waygood.gh-98778 [https://github.com/python/cpython/issues/98778]: Update
HTTPError
to be initialized properly, even if thefp
isNone
. Patch by Donghee Na.gh-99925 [https://github.com/python/cpython/issues/99925]: Unify error messages in JSON serialization between
json.dumps(float('nan'), allow_nan=False)
andjson.dumps(float('nan'), allow_nan=False, indent=
. Now both include the representation of the value that could not be serialized.) gh-89727 [https://github.com/python/cpython/issues/89727]: Fix issue with
os.walk()
where aRecursionError
would occur on deep directory structures by adjusting the implementation ofos.walk()
to be iterative instead of recursive.gh-94943 [https://github.com/python/cpython/issues/94943]: Add 数据类支持 to the
Enum
_repr_()
. When inheriting from adataclass
, only show the field names in the value section of the memberrepr()
, and not the dataclass' class name.gh-83035 [https://github.com/python/cpython/issues/83035]: Fix
inspect.getsource()
handling of decorator calls with nested parentheses.gh-99576 [https://github.com/python/cpython/issues/99576]: Fix
.save()
method forLWPCookieJar
andMozillaCookieJar
: saved file was not truncated on repeated save.gh-94912 [https://github.com/python/cpython/issues/94912]: Add
inspect.markcoroutinefunction()
decorator which manually marks a function as a coroutine for the benefit ofiscoroutinefunction()
.gh-99509 [https://github.com/python/cpython/issues/99509]: Add PEP 585 [https://peps.python.org/pep-0585/] support for
multiprocessing.queues.Queue
.gh-99482 [https://github.com/python/cpython/issues/99482]: Remove
Jython
partial compatibility code from several stdlib modules.gh-99433 [https://github.com/python/cpython/issues/99433]: Fix
doctest
failure ontypes.MethodWrapperType
in modules.gh-85267 [https://github.com/python/cpython/issues/85267]: Several improvements to
inspect.signature()
's handling of__text_signature
. - Fixes a case whereinspect.signature()
dropped parameters - Fixes a case whereinspect.signature()
raisedtokenize.TokenError
- Allowsinspect.signature()
to understand defaults involving binary operations of constants -inspect.signature()
is documented as only raisingTypeError
orValueError
, but sometimes raisedRuntimeError
. These cases now raiseValueError
- Removed a dead code pathgh-91166 [https://github.com/python/cpython/issues/91166]:
asyncio
is optimized to avoid excessive copying when writing to socket and usesendmsg()
if the platform supports it. Patch by Kumar Aditya.gh-98030 [https://github.com/python/cpython/issues/98030]: Add missing TCP socket options from Linux:
TCP_MD5SIG
,TCP_THIN_LINEAR_TIMEOUTS
,TCP_THIN_DUPACK
,TCP_REPAIR
,TCP_REPAIR_QUEUE
,TCP_QUEUE_SEQ
,TCP_REPAIR_OPTIONS
,TCP_TIMESTAMP
,TCP_CC_INFO
,TCP_SAVE_SYN
,TCP_SAVED_SYN
,TCP_REPAIR_WINDOW
,TCP_FASTOPEN_CONNECT
,TCP_ULP
,TCP_MD5SIG_EXT
,TCP_FASTOPEN_KEY
,TCP_FASTOPEN_NO_COOKIE
,TCP_ZEROCOPY_RECEIVE
,TCP_INQ
,TCP_TX_DELAY
.gh-88500 [https://github.com/python/cpython/issues/88500]: Reduced the memory usage of
urllib.parse.unquote()
andurllib.parse.unquote_to_bytes()
on large values.gh-96127 [https://github.com/python/cpython/issues/96127]:
inspect.signature
was raisingTypeError
on call with mock objects. Now it correctly returns(*args, **kwargs)
as inferred signature.gh-95882 [https://github.com/python/cpython/issues/95882]: Fix a 3.11 regression in
asynccontextmanager()
, which caused it to propagate exceptions with incorrect tracebacks and fix a 3.11 regression incontextmanager()
, which caused it to propagate exceptions with incorrect tracebacks forStopIteration
.gh-78707 [https://github.com/python/cpython/issues/78707]: Deprecate passing more than one positional argument to
pathlib.PurePath.relative_to()
andis_relative_to()
.gh-92122 [https://github.com/python/cpython/issues/92122]: Fix reStructuredText syntax errors in docstrings in the
enum
module.gh-91851 [https://github.com/python/cpython/issues/91851]: Optimize the
Fraction
arithmetics for small components.bpo-24132 [https://bugs.python.org/issue?@action=redirect&bpo=24132]: Make
pathlib.PurePath
andPath
subclassable (private to start). Previously, attempting to instantiate a subclass resulted in anAttributeError
being raised. Patch by Barney Gale.bpo-40447 [https://bugs.python.org/issue?@action=redirect&bpo=40447]: Accept
os.PathLike
(such aspathlib.Path
) in thestripdir
arguments ofcompileall.compile_file()
andcompileall.compile_dir()
.bpo-36880 [https://bugs.python.org/issue?@action=redirect&bpo=36880]: Fix a reference counting issue when a
ctypes
callback with return typepy_object
returnsNone
, which could cause crashes.