安全性
gh-115399 [https://github.com/python/cpython/issues/115399]: Update bundled libexpat to 2.6.0
gh-115243 [https://github.com/python/cpython/issues/115243]: Fix possible crashes in
collections.deque.index()
when the deque is concurrently modified.
核心与内置函数
gh-112087 [https://github.com/python/cpython/issues/112087]: For an empty reverse iterator for list will be reduced to
reversed()
. Patch by Donghee Nagh-114570 [https://github.com/python/cpython/issues/114570]: Add
PythonFinalizationError
exception. This exception derived fromRuntimeError
is raised when an operation is blocked during the Python finalization. Patch by Victor Stinner.gh-114695 [https://github.com/python/cpython/issues/114695]: Add
sys._clear_internal_caches()
, which clears all internal performance-related caches (and deprecate the less-generalsys._clear_type_cache()
function).gh-114828 [https://github.com/python/cpython/issues/114828]: Fix compilation crashes in uncommon code examples using
super()
inside a comprehension in a class body.gh-112069 [https://github.com/python/cpython/issues/112069]: Adapt
set
andfrozenset
methods to Argument Clinic.gh-115011 [https://github.com/python/cpython/issues/115011]: Setters for members with an unsigned integer type now support the same range of valid values for objects that has a
__index__()
method as forint
.gh-114887 [https://github.com/python/cpython/issues/114887]: Changed socket type validation in
create_datagram_endpoint()
to accept all non-stream sockets. This fixes a regression in compatibility with raw sockets.gh-114944 [https://github.com/python/cpython/issues/114944]: Fixes a race between
PyParkingLot_Park
andPyParkingLotUnparkAll
.gh-113462 [https://github.com/python/cpython/issues/113462]: Limit the number of versions that a single class can use. Prevents a few wayward classes using up all the version numbers.
gh-76763 [https://github.com/python/cpython/issues/76763]: The
chr()
builtin function now always raisesValueError
for values outside the valid range. Previously it raisedOverflowError
for very large or small values.gh-114806 [https://github.com/python/cpython/issues/114806]: No longer specialize calls to classes, if those classes have metaclasses. Fixes bug where the
__call__
method of the metaclass was not being called.gh-107944 [https://github.com/python/cpython/issues/107944]: Improve error message for function calls with bad keyword arguments via getargs
gh-112529 [https://github.com/python/cpython/issues/112529]: The free-threaded build no longer allocates space for the
PyGC_Head
structure in objects that support cyclic garbage collection. A number of other fields and data structures are used as replacements, includingob_gc_bits
,ob_tid
, and mimalloc internal data structures.gh-114456 [https://github.com/python/cpython/issues/114456]: Lower the recursion limit under a debug build of WASI.
gh-114083 [https://github.com/python/cpython/issues/114083]: Compiler applies folding of LOAD_CONST with following instruction in a separate pass before other optimisations. This enables jump threading in certain circumstances.
gh-114388 [https://github.com/python/cpython/issues/114388]: Fix a
RuntimeWarning
emitted when assign an integer-like value that is not an instance ofint
to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. Fix a doubleRuntimeWarning
emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT.gh-114265 [https://github.com/python/cpython/issues/114265]: Compiler propagates line numbers before optimization, leading to more optimization opportunities and removing the need for the
guarantee_lineno_for_exits
hack.gh-112529 [https://github.com/python/cpython/issues/112529]: The free-threaded build now has its own threadsafe GC implementation that uses mimalloc to find GC tracked objects. It is non-generational, unlike the existing GC implementation.
gh-114050 [https://github.com/python/cpython/issues/114050]: Fix segmentation fault caused by an incorrect format string in
TypeError
exception when more than two arguments are passed toint
.gh-112354 [https://github.com/python/cpython/issues/112354]: The
END_FOR
instruction now pops only one value. This is to better support side exits in loops.gh-113884 [https://github.com/python/cpython/issues/113884]: Make
queue.SimpleQueue
thread safe when the GIL is disabled.gh-114058 [https://github.com/python/cpython/issues/114058]: Implement the foundations of the Tier 2 redundancy eliminator.
gh-113939 [https://github.com/python/cpython/issues/113939]: frame.clear(): Clear frame.f_locals as well, and not only the fast locals. This is relevant once frame.f_locals was accessed, which would contain also references to all the locals.
gh-112050 [https://github.com/python/cpython/issues/112050]: Convert
collections.deque
to use Argument Clinic.gh-112050 [https://github.com/python/cpython/issues/112050]: Make methods on
collections.deque
threadsafe when the GIL is disabled.gh-113464 [https://github.com/python/cpython/issues/113464]: Add an option (
--enable-experimental-jit
forconfigure
-based builds or--experimental-jit
forPCbuild
-based ones) to build an experimental just-in-time compiler, based on copy-and-patch [https://fredrikbk.com/publications/copy-and-patch.pdf]gh-113055 [https://github.com/python/cpython/issues/113055]: Make interp->obmalloc a pointer. For interpreters that share state with the main interpreter, this points to the same static memory structure. For interpreters with their own obmalloc state, it is heap allocated. Add free_obmalloc_arenas() which will free the obmalloc arenas and radix tree structures for interpreters with their own obmalloc state.
gh-55664 [https://github.com/python/cpython/issues/55664]: Add warning when creating
type
using a namespace dictionary with non-string keys. Patched by Daniel Urban and Furkan Onder.gh-104530 [https://github.com/python/cpython/issues/104530]: Use native Win32 condition variables.
库
gh-115392 [https://github.com/python/cpython/issues/115392]: Fix a bug in
doctest
where incorrect line numbers would be reported for decorated functions.gh-114563 [https://github.com/python/cpython/issues/114563]: Fix several
format()
bugs when using the C implementation ofDecimal
: memory leak in some rare cases when using thez
format option (coerce negative 0) incorrect output when applying thez
format option to typeF
(fixed-point with capitalNAN
/INF
) * incorrect output when applying the#
format option (alternate form)gh-102840 [https://github.com/python/cpython/issues/102840]: Fix confused traceback when floordiv, mod, or divmod operations happens between instances of
fractions.Fraction
andcomplex
.gh-115165 [https://github.com/python/cpython/issues/115165]: Most exceptions are now ignored when attempting to set the
__orig_class__
attribute on objects returned when callingtyping
generic aliases (including generic aliases created usingtyping.Annotated
). Previously onlyAttributeError
was ignored. Patch by Dave Shawley.gh-112903 [https://github.com/python/cpython/issues/112903]: Fix "issubclass() arg 1 must be a class" errors in certain cases of multiple inheritance with generic aliases (regression in early 3.13 alpha releases).
gh-115133 [https://github.com/python/cpython/issues/115133]: Fix tests for
XMLPullParser
with Expat 2.6.0.gh-115059 [https://github.com/python/cpython/issues/115059]:
io.BufferedRandom.read1()
now flushes the underlying write buffer.gh-79382 [https://github.com/python/cpython/issues/79382]: Trailing
**
no longer allows to match files and nonexisting paths in recursiveglob()
.gh-67837 [https://github.com/python/cpython/issues/67837]: Avoid race conditions in the creation of directories during concurrent extraction in
tarfile
andzipfile
.gh-115060 [https://github.com/python/cpython/issues/115060]: Speed up
pathlib.Path.glob()
by removing redundant regex matching.gh-97928 [https://github.com/python/cpython/issues/97928]: Partially revert the behavior of
tkinter.Text.count()
. By default it preserves the behavior of older Python versions, except that settingwantobjects
to 0 no longer has effect. Add a new parameter return_ints: specifyingreturn_ints=True
makesText.count()
always returning the single count as an integer instead of a 1-tuple orNone
.gh-114628 [https://github.com/python/cpython/issues/114628]: When csv.Error is raised when handling TypeError, do not print the TypeError traceback.
gh-85984 [https://github.com/python/cpython/issues/85984]: Added
POSIXVDISABLE
from C's
totermios
.gh-114965 [https://github.com/python/cpython/issues/114965]: Update bundled pip to 24.0
gh-114959 [https://github.com/python/cpython/issues/114959]:
tarfile
no longer ignores errors when trying to extract a directory on top of a file.gh-114894 [https://github.com/python/cpython/issues/114894]: Add
array.array.clear()
.gh-114071 [https://github.com/python/cpython/issues/114071]: Support tuple subclasses using auto() for enum member value.
gh-109475 [https://github.com/python/cpython/issues/109475]: Fix support of explicit option value "—" in
argparse
(e.g.--option=--
).gh-49766 [https://github.com/python/cpython/issues/49766]: Fix
date
-datetime
comparison. Now the special comparison methods like__eq__
and__lt__
returnNotImplemented
if one of comparands isdate
and other isdatetime
instead of ignoring the time part and the time zone or forcefully return "not equal" or raiseTypeError
. It makes comparison ofdate
anddatetime
subclasses more symmetric and allows to change the default behavior by overriding the special comparison methods in subclasses.gh-110190 [https://github.com/python/cpython/issues/110190]: Fix ctypes structs with array on Windows ARM64 platform by setting
MAX_STRUCT_SIZE
to 32 in stgdict. Patch by Diego Russogh-114678 [https://github.com/python/cpython/issues/114678]: Ensure that deprecation warning for 'N' specifier in
Decimal
format is not raised for cases where 'N' appears in other places in the format specifier. Based on patch by Stefan Krah.gh-70303 [https://github.com/python/cpython/issues/70303]: Return both files and directories from
pathlib.Path.glob()
if a pattern ends with "**
". Previously only directories were returned.gh-109653 [https://github.com/python/cpython/issues/109653]: Improve import time of
importlib.metadata
andemail.utils
.gh-113280 [https://github.com/python/cpython/issues/113280]: Fix a leak of open socket in rare cases when error occurred in
ssl.SSLSocket
creation.gh-77749 [https://github.com/python/cpython/issues/77749]:
email.policy.EmailPolicy.fold()
now always encodes nonASCII characters in headers ifutf8
is false.gh-83383 [https://github.com/python/cpython/issues/83383]: Synchronization of the
dbm.dumb
database is now no-op if there was no modification since opening or last synchronization. The directory file for a newly created emptydbm.dumb
database is now created immediately after opening instead of deferring this until synchronizing or closing.gh-91602 [https://github.com/python/cpython/issues/91602]: Add filter keyword-only parameter to
sqlite3.Connection.iterdump()
for filtering database objects to dump. Patch by Mariusz Felisiak.gh-112451 [https://github.com/python/cpython/issues/112451]: Prohibit subclassing pure-Python
datetime.timezone
. This is consistent with C-extension implementation. Patch by Mariusz Felisiak.gh-69893 [https://github.com/python/cpython/issues/69893]: Add the
close()
method for the iterator returned byxml.etree.ElementTree.iterparse()
.gh-109653 [https://github.com/python/cpython/issues/109653]: Reduce the import time of
threading
module by ~50%. Patch by Daniel Hollas.gh-114492 [https://github.com/python/cpython/issues/114492]: Make the result of
termios.tcgetattr()
reproducible on Alpine Linux. Previously it could leave a random garbage in some fields.gh-114315 [https://github.com/python/cpython/issues/114315]: Make
threading.Lock
a real class, not a factory function. Add_new_
to_thread.lock
type.gh-100414 [https://github.com/python/cpython/issues/100414]: Add
dbm.sqlite3
as a backend todbm
, and make it the new defaultdbm
backend. Patch by Raymond Hettinger and Erlend E. Aasland.gh-113267 [https://github.com/python/cpython/issues/113267]: Revert changes in gh-106584 [https://github.com/python/cpython/issues/106584] which made calls of
TestResult
methodsstartTest()
andstopTest()
unbalanced.gh-75128 [https://github.com/python/cpython/issues/75128]: Ignore an
OSError
inasyncio.BaseEventLoop.create_server()
when IPv6 is available but the interface cannot actually support it.gh-114423 [https://github.com/python/cpython/issues/114423]:
_DummyThread
entries inthreading._active
are now automatically removed when the related thread dies.gh-114257 [https://github.com/python/cpython/issues/114257]: Dismiss the
FileNotFound
error inctypes.util.find_library()
and just returnNone
on Linux.gh-114321 [https://github.com/python/cpython/issues/114321]: Expose more platform specific constants in the
fcntl
module on Linux, macOS, FreeBSD and NetBSD.gh-114328 [https://github.com/python/cpython/issues/114328]: The
tty.setcbreak()
and newtty.cfmakecbreak()
no longer clears the terminal input ICRLF flag. This fixes a regression introduced in 3.12 that no longer matched how OSes define cbreak mode in theirstty(1)
manual pages.gh-114281 [https://github.com/python/cpython/issues/114281]: Remove type hints from
Lib/asyncio/staggered.py
. The annotations in the typeshed [https://github.com/python/typeshed] project should be used instead.gh-101438 [https://github.com/python/cpython/issues/101438]: Avoid reference cycle in ElementTree.iterparse. The iterator returned by
ElementTree.iterparse
may hold on to a file descriptor. The reference cycle prevented prompt cleanup of the file descriptor if the returned iterator was not exhausted.gh-114198 [https://github.com/python/cpython/issues/114198]: The signature for the
__replace__
method ondataclasses
now has the first argument namedself
, rather thanobj
.gh-104522 [https://github.com/python/cpython/issues/104522]:
OSError
raised when run a subprocess now only has filename attribute set to cwd if the error was caused by a failed attempt to change the current directory.gh-114149 [https://github.com/python/cpython/issues/114149]: Enum: correctly handle tuple subclasses in custom
_new_
.gh-83648 [https://github.com/python/cpython/issues/83648]: Support deprecation of options, positional arguments and subcommands in
argparse
.gh-114087 [https://github.com/python/cpython/issues/114087]: Speed up
dataclasses.asdict
up to 1.35x.gh-109534 [https://github.com/python/cpython/issues/109534]: Fix a reference leak in
asyncio.selector_events.BaseSelectorEventLoop
when SSL handshakes fail. Patch contributed by Jamie Phan.gh-79634 [https://github.com/python/cpython/issues/79634]: Accept pathlike objects as patterns in
pathlib.Path.glob()
andrglob()
.gh-112202 [https://github.com/python/cpython/issues/112202]: Ensure that a
asyncio.Condition.notify()
call does not get lost if the awakenedTask
is simultaneously cancelled or encounters any other error.gh-113951 [https://github.com/python/cpython/issues/113951]: Fix the behavior of
tag_unbind()
methods oftkinter.Text
andtkinter.Canvas
classes with three arguments. Previously,widget.tag_unbind(tag, sequence, funcid)
destroyed the current binding for sequence, leaving sequence unbound, and deleted the funcid command. Now it removes only funcid from the binding for sequence, keeping other commands, and deletes the funcid command. It leaves sequence unbound only if funcid was the last bound command.gh-97959 [https://github.com/python/cpython/issues/97959]: Fix rendering class methods, bound methods, method and function aliases in
pydoc
. Class methods no longer have "method of builtins.type instance" note. Corresponding notes are now added for class and unbound methods. Method and function aliases now have references to the module or the class where the origin was defined if it differs from the current. Bound methods are now listed in the static methods section. Methods of builtin classes are now supported as well as methods of Python classes.gh-113796 [https://github.com/python/cpython/issues/113796]: Add more validation checks in the
csv.Dialect
constructor.ValueError
is now raised if the same character is used in different roles.gh-113732 [https://github.com/python/cpython/issues/113732]: Fix support of
QUOTE_NOTNULL
andQUOTE_STRINGS
incsv.reader()
.gh-113225 [https://github.com/python/cpython/issues/113225]: Speed up
pathlib.Path.walk()
by usingos.DirEntry.path
where possible.gh-89039 [https://github.com/python/cpython/issues/89039]: When replace() method is called on a subclass of datetime, date or time, properly call derived constructor. Previously, only the base class's constructor was called.
Also, make sure to pass non-zero fold values when creating subclasses in various methods. Previously, fold was silently ignored.
gh-112919 [https://github.com/python/cpython/issues/112919]: Speedup
datetime.datetime.replace()
,datetime.date.replace()
anddatetime.time.replace()
.gh-59013 [https://github.com/python/cpython/issues/59013]: Set breakpoint on the first executable line of the function, instead of the line of function definition when the user do
break func
usingpdb
gh-112343 [https://github.com/python/cpython/issues/112343]: Improve handling of pdb convenience variables to avoid replacing string contents.
gh-112240 [https://github.com/python/cpython/issues/112240]: Add option to calendar module CLI to specify the weekday to start each week. Patch by Steven Ward.
gh-111741 [https://github.com/python/cpython/issues/111741]: Recognise
image/webp
as a standard format in themimetypes
module.gh-43457 [https://github.com/python/cpython/issues/43457]: Fix the
tkinter
widget methodwm_attributes()
. It now accepts the attribute name without the minus prefix to get window attributes and allows to specify attributes and values to set as keyword arguments. Add new optional keyword argument return_python_dict: callingw.wm_attributes(return_python_dict=True)
returns the attributes as a dict instead of a tuple. Callingw.wm_attributes()
now returns a tuple instead of string if wantobjects was set to 0.gh-82626 [https://github.com/python/cpython/issues/82626]: Many functions now emit a warning if a boolean value is passed as a file descriptor argument.
gh-111051 [https://github.com/python/cpython/issues/111051]: Added check for file modification during debugging with
pdb
gh-110345 [https://github.com/python/cpython/issues/110345]: Show the Tcl/Tk patchlevel (rather than version) in
tkinter._test()
.gh-38807 [https://github.com/python/cpython/issues/38807]: Fix race condition in
trace
. Instead of checking if a directory exists and creating it, directly callos.makedirs()
with the kwargexist_ok=True
.gh-75705 [https://github.com/python/cpython/issues/75705]: Set unixfrom envelope in
mailbox.mbox
andmailbox.MMDF
.gh-106233 [https://github.com/python/cpython/issues/106233]: Fix stacklevel in
InvalidTZPathWarning
duringzoneinfo
module import.gh-105102 [https://github.com/python/cpython/issues/105102]: Allow
ctypes.Union
to be nested inctypes.Structure
when the system endianness is the opposite of the classes.gh-104282 [https://github.com/python/cpython/issues/104282]: Fix null pointer dereference in
lzma._decode_filter_properties()
due to improper handling of BCJ filters with properties of zero length. Patch by Radislav Chugunov.gh-96471 [https://github.com/python/cpython/issues/96471]: Add
queue.Queue
termination withshutdown()
.gh-101599 [https://github.com/python/cpython/issues/101599]: Changed argparse flag options formatting to remove redundancy.
gh-85984 [https://github.com/python/cpython/issues/85984]: Add POSIX pseudo-terminal functions
os.posix_openpt()
,os.grantpt()
,os.unlockpt()
, andos.ptsname()
.gh-102512 [https://github.com/python/cpython/issues/102512]: When
os.fork()
is called from a foreign thread (aka_DummyThread
), the type of the thread in a child process is changed to_MainThread
. Also changed its name and daemonic status, it can be now joined.gh-88569 [https://github.com/python/cpython/issues/88569]: Add
os.path.isreserved()
, which identifies reserved pathnames such as "NUL", "AUX" and "CON". This function is only available on Windows.
Deprecate pathlib.PurePath.is_reserved()
.
- bpo-38364 [https://bugs.python.org/issue?@action=redirect&bpo=38364]: The
inspect
functionsisgeneratorfunction
,iscoroutinefunction
,isasyncgenfunction
now supportfunctools.partialmethod
wrapped functions the same way they supportfunctools.partial
.
文档
gh-115233 [https://github.com/python/cpython/issues/115233]: Fix an example for
LoggerAdapter
in the Logging Cookbook.gh-114123 [https://github.com/python/cpython/issues/114123]: Move the
csv
module docstring to thecsv
module instead of reexporting it from the internal_csv
module, and remove__doc__
fromcsv.__all__
.
Move csv.__version__
to the csv
module instead of reexporting it from the internal _csv
module, and remove __version__
from csv.__all__
.
测试
gh-114099 [https://github.com/python/cpython/issues/114099]: Added test exclusions required to run the test suite on iOS.
gh-105089 [https://github.com/python/cpython/issues/105089]: Fix
test.test_zipfile.test_core.TestWithDirectory.test_create_directory_with_write
test in AIX by doing a bitwise AND of 0xFFFF on mode , so that it will be in sync withzinfo.external_attr
构建
gh-115167 [https://github.com/python/cpython/issues/115167]: Avoid vendoring
vcruntime140_threads.dll
when building with Visual Studio 2022 version 17.8.gh-113632 [https://github.com/python/cpython/issues/113632]: Promote WASI to a tier 2 platform and drop Emscripten from tier 3 in configure.ac.
gh-114099 [https://github.com/python/cpython/issues/114099]: configure and Makefile were refactored to accommodate framework builds on Apple platforms other than macOS.
gh-114875 [https://github.com/python/cpython/issues/114875]: Add
getgrent()
as a prerequisite for building thegrp
module.
Windows
gh-115049 [https://github.com/python/cpython/issues/115049]: Fixes
py.exe
launcher failing when run as users without user profiles.gh-115009 [https://github.com/python/cpython/issues/115009]: Update Windows installer to use SQLite 3.45.1.
gh-109991 [https://github.com/python/cpython/issues/109991]: Update Windows build to use OpenSSL 3.0.13.
gh-111239 [https://github.com/python/cpython/issues/111239]: Update Windows builds to use zlib v1.3.1.
gh-100107 [https://github.com/python/cpython/issues/100107]: The
py.exe
launcher will no longer attempt to run the Microsoft Store redirector when launching a script containing ausrbin/env
shebanggh-112984 [https://github.com/python/cpython/issues/112984]: Adds free-threaded binaries to Windows installer as an optional component.
gh-89240 [https://github.com/python/cpython/issues/89240]: Allows
multiprocessing
to create pools of greater than 62 processes.
macOS
gh-115009 [https://github.com/python/cpython/issues/115009]: Update macOS installer to use SQLite 3.45.1.
gh-109991 [https://github.com/python/cpython/issues/109991]: Update macOS installer to use OpenSSL 3.0.13.
gh-114490 [https://github.com/python/cpython/issues/114490]: Add Mach-O linkage support for
platform.architecture()
.gh-87804 [https://github.com/python/cpython/issues/87804]: On macOS the result of
os.statvfs
andos.fstatvfs
now correctly report the size of very large disks, in previous versions the reported number of blocks was wrong for disks with at least 2**32 blocks.
IDLE
gh-96905 [https://github.com/python/cpython/issues/96905]: In idlelib code, stop redefining builtins 'dict' and 'object'.
gh-103820 [https://github.com/python/cpython/issues/103820]: Revise IDLE bindings so that events from mouse button 4/5 on non-X11 windowing systems (i.e. Win32 and Aqua) are not mistaken for scrolling.
工具/示例
gh-113516 [https://github.com/python/cpython/issues/113516]: Don't set
LDSHARED
when building for WASI.gh-109991 [https://github.com/python/cpython/issues/109991]: Update GitHub CI workflows to use OpenSSL 3.0.13 and multissltests to use 1.1.1w, 3.0.13, 3.1.5, and 3.2.1.
gh-115015 [https://github.com/python/cpython/issues/115015]: Fix a bug in Argument Clinic that generated incorrect code for methods with no parameters that use the METH_METHOD | METH_FASTCALL | METH_KEYWORDS calling convention. Only the positional parameter count was checked; any keyword argument passed would be silently accepted.
C API
gh-111140 [https://github.com/python/cpython/issues/111140]: Adds
PyLong_AsNativeBytes()
,PyLong_FromNativeBytes()
andPyLong_FromUnsignedNativeBytes()
functions.gh-114685 [https://github.com/python/cpython/issues/114685]:
PyBuffer_FillInfo()
now raises aSystemError
if called withPyBUF_READ
orPyBUF_WRITE
as flags. These flags should only be used with thePyMemoryView_*
C API.gh-114685 [https://github.com/python/cpython/issues/114685]:
PyObject_GetBuffer()
now raises aSystemError
if called withPyBUF_READ
orPyBUF_WRITE
as flags. These flags should only be used with thePyMemoryView_*
C API.gh-114626 [https://github.com/python/cpython/issues/114626]: Add
PyCFunctionFast
andPyCFunctionFastWithKeywords
typedefs (identical to the existing_PyCFunctionFast
and_PyCFunctionFastWithKeywords
typedefs, just without a leading_
prefix).gh-114329 [https://github.com/python/cpython/issues/114329]: Add
PyList_GetItemRef()
, which is similar toPyList_GetItem()
but returns a strong reference instead of a borrowed reference.gh-110850 [https://github.com/python/cpython/issues/110850]: Add PyTime C API:
PyTime_t
类型。PyTime_MIN
和PyTime_MAX
常量。PyTime_AsSecondsDouble()
,PyTime_Monotonic()
,PyTime_PerfCounter()
, andPyTime_Time()
functions.
Patch by Victor Stinner.
- gh-112066 [https://github.com/python/cpython/issues/112066]: Add
PyDict_SetDefaultRef()
: insert a key and value into a dictionary if the key is not already present. This is similar todict.setdefault()
, but returns an integer value indicating if the key was already present. It is also similar toPyDict_SetDefault()
, but returns a strong reference instead of a borrowed reference.
Python 3.13.0 alpha 3
Release date: 2024-01-17
安全性
gh-113659 [https://github.com/python/cpython/issues/113659]: Skip
.pth
files with names starting with a dot or hidden file attribute.gh-112302 [https://github.com/python/cpython/issues/112302]: Created a Software Bill-of-Materials document and tooling for tracking dependencies.
核心与内置函数
gh-107901 [https://github.com/python/cpython/issues/107901]: Compiler duplicates basic blocks that have an eval breaker check, no line number, and multiple predecessors.
gh-107901 [https://github.com/python/cpython/issues/107901]: A jump leaving an exception handler back to normal code no longer checks the eval breaker.
gh-113655 [https://github.com/python/cpython/issues/113655]: Set the C recursion limit to 4000 on Windows, and 10000 on Linux/OSX. This seems to be near the sweet spot to maintain safety, but not compromise backwards compatibility.
gh-113710 [https://github.com/python/cpython/issues/113710]: Add typed stack effects to the interpreter DSL, along with various instruction annotations.
gh-77046 [https://github.com/python/cpython/issues/77046]: On Windows, file descriptors wrapping Windows handles are now created non inheritable by default ( PEP 446 [https://peps.python.org/pep-0446/]). Patch by Zackery Spytz and Victor Stinner.
gh-113853 [https://github.com/python/cpython/issues/113853]: Guarantee that all executors make progress. This then guarantees that tier 2 execution always makes progress.
gh-113753 [https://github.com/python/cpython/issues/113753]: Fix an issue where the finalizer of
PyAsyncGenASend
objects might not be called if they were allocated from a free list.gh-107901 [https://github.com/python/cpython/issues/107901]: Compiler changed so that synthetic jumps which are not at loop end no longer check the eval breaker.
gh-113703 [https://github.com/python/cpython/issues/113703]: Fix a regression in the
codeop
module that was causing it to incorrectly identify incomplete fstrings. Patch by Pablo Galindogh-89811 [https://github.com/python/cpython/issues/89811]: Check for a valid
tp_version_tag
before performing bytecode specializations that rely on this value being usable.gh-111488 [https://github.com/python/cpython/issues/111488]: Changed error message in case of no 'in' keyword after 'for' in list comprehensions
gh-113657 [https://github.com/python/cpython/issues/113657]: Fix an issue that caused important instruction pointer updates to be optimized out of tier two traces.
gh-113603 [https://github.com/python/cpython/issues/113603]: Fixed bug where a redundant NOP is not removed, causing an assertion to fail in the compiler in debug mode.
gh-113602 [https://github.com/python/cpython/issues/113602]: Fix an error that was causing the parser to try to overwrite existing errors and crashing in the process. Patch by Pablo Galindo
gh-113486 [https://github.com/python/cpython/issues/113486]: No longer issue spurious
PY_UNWIND
events for optimized calls to classes.gh-113297 [https://github.com/python/cpython/issues/113297]: Fix segfault in the compiler on with statement with 19 context managers.
gh-113212 [https://github.com/python/cpython/issues/113212]: Improve
super
error messages.gh-111375 [https://github.com/python/cpython/issues/111375]: Only use
NULL
in the exception stack to indicate an exception was handled. Patch by Carey Metcalfe.gh-112215 [https://github.com/python/cpython/issues/112215]: Increase the C recursion limit by a factor of 3 for non-debug builds, except for webassembly and s390 platforms which are unchanged. This mitigates some regressions in 3.12 with deep recursion mixing builtin (C) and Python code.
gh-113054 [https://github.com/python/cpython/issues/113054]: Fixed bug where a redundant NOP is not removed, causing an assertion to fail in the compiler in debug mode.
gh-106905 [https://github.com/python/cpython/issues/106905]: Use per AST-parser state rather than global state to track recursion depth within the AST parser to prevent potential race condition due to simultaneous parsing.
The issue primarily showed up in 3.11 by multithreaded users of ast.parse()
. In 3.12 a change to when garbage collection can be triggered prevented the race condition from occurring.
gh-108866 [https://github.com/python/cpython/issues/108866]: Change the API and contract of
_PyExecutorObject
to return the next_instr pointer, instead of the frame, and to always execute at least one instruction.gh-90350 [https://github.com/python/cpython/issues/90350]: Optimize builtin functions
min()
andmax()
.gh-112943 [https://github.com/python/cpython/issues/112943]: Correctly compute end column offsets for multiline tokens in the
tokenize
module. Patch by Pablo Galindogh-112125 [https://github.com/python/cpython/issues/112125]: Fix
None._ne_(None)
returningNotImplemented
instead ofFalse
.gh-74616 [https://github.com/python/cpython/issues/74616]:
input()
now raises a ValueError when output on the terminal if the prompt contains embedded null characters instead of silently truncating it.gh-112716 [https://github.com/python/cpython/issues/112716]: Fix SystemError in the
import
statement and in__reduce__()
methods of builtin types when__builtins__
is not a dict.gh-112730 [https://github.com/python/cpython/issues/112730]: Use color to highlight error locations in tracebacks. Patch by Pablo Galindo
gh-112625 [https://github.com/python/cpython/issues/112625]: Fixes a bug where a bytearray object could be cleared while iterating over an argument in the
bytearray.join()
method that could result in reading memory after it was freed.gh-112660 [https://github.com/python/cpython/issues/112660]: Do not clear unexpected errors during formatting error messages for ImportError and AttributeError for modules.
gh-105967 [https://github.com/python/cpython/issues/105967]: Workaround a bug in Apple's macOS platform zlib library where
zlib.crc32()
andbinascii.crc32()
could produce incorrect results on multi-gigabyte inputs. Including when usingzipfile
on zips containing large data.gh-95754 [https://github.com/python/cpython/issues/95754]: Provide a better error message when accessing invalid attributes on partially initialized modules. The origin of the module being accessed is now included in the message to help with the common issue of shadowing other modules.
gh-112217 [https://github.com/python/cpython/issues/112217]: Add check for the type of
__cause__
returned from calling the typeT
inraise from T
.gh-111058 [https://github.com/python/cpython/issues/111058]: Change coro.cr_frame/gen.gi_frame to return
None
after the coroutine/generator has been closed. This fixes a bug wheregetcoroutinestate()
andgetgeneratorstate()
return the wrong state for a closed coroutine/generator.gh-112388 [https://github.com/python/cpython/issues/112388]: Fix an error that was causing the parser to try to overwrite tokenizer errors. Patch by pablo Galindo
gh-112387 [https://github.com/python/cpython/issues/112387]: Fix error positions for decoded strings with backwards tokenize errors. Patch by Pablo Galindo
gh-99606 [https://github.com/python/cpython/issues/99606]: Make code generated for an empty fstring identical to the code of an empty normal string.
gh-112367 [https://github.com/python/cpython/issues/112367]: Avoid undefined behaviour when using the perf trampolines by not freeing the code arenas until shutdown. Patch by Pablo Galindo
gh-112320 [https://github.com/python/cpython/issues/112320]: The Tier 2 translator now tracks the confidence level for staying "on trace" (i.e. not exiting back to the Tier 1 interpreter) for branch instructions based on the number of bits set in the branch "counter". Trace translation ends when the confidence drops below 1/3rd.
gh-109598 [https://github.com/python/cpython/issues/109598]:
PyComplex_RealAsDouble()
/PyComplex_ImagAsDouble()
now tries to convert an object to acomplex
instance using its__complex__()
method before falling back to the__float__()
method. Patch by Sergey B Kirpichev.gh-94606 [https://github.com/python/cpython/issues/94606]: Fix UnicodeEncodeError when
email.message.get_payload()
reads a message with a Unicode surrogate character and the message content is not well-formed for surrogateescape encoding. Patch by Sidney Markowitz.bpo-21861 [https://bugs.python.org/issue?@action=redirect&bpo=21861]: Use the object's actual class name in
io.FileIO.repr_()
,io.WindowsConsoleIO()
andio.TextIOWrapper.repr_()
, to make these methods subclass friendly.bpo-45369 [https://bugs.python.org/issue?@action=redirect&bpo=45369]: Remove LibreSSL workarounds as per PEP 644 [https://peps.python.org/pep-0644/].
bpo-34392 [https://bugs.python.org/issue?@action=redirect&bpo=34392]: Added
sys._is_interned()
.
库
gh-114077 [https://github.com/python/cpython/issues/114077]: Fix possible
OverflowError
insocket.socket.sendfile()
when pass count larger than 2 GiB on 32-bit platform.gh-111803 [https://github.com/python/cpython/issues/111803]:
plistlib
now supports loading more deeply nested lists in binary format.gh-114014 [https://github.com/python/cpython/issues/114014]: Fixed a bug in
fractions.Fraction
where an invalid string usingd
in the decimals part creates a different error compared to other invalid letters/characters. Patch by Jeremiah Gabriel Pascual.gh-108364 [https://github.com/python/cpython/issues/108364]:
sqlite3.Connection.iterdump()
now ensures that foreign key support is disabled before dumping the database schema, if there is any foreign key violation. Patch by Erlend E. Aasland and Mariusz Felisiak.gh-113971 [https://github.com/python/cpython/issues/113971]: The
zipfile.ZipInfo
previously protected._compresslevel
attribute has been made public as.compress_level
with the old_compresslevel
name remaining available as a property to retain compatibility.gh-113877 [https://github.com/python/cpython/issues/113877]: Fix
tkinter
methodwinfo_pathname()
on 64-bit Windows.gh-113868 [https://github.com/python/cpython/issues/113868]: Added
mmap.MAP_NORESERVE
,mmap.MAP_NOEXTEND
,mmap.MAP_HASSEMAPHORE
,mmap.MAP_NOCACHE
,mmap.MAP_JIT
,mmap.MAP_RESILIENT_CODESIGN
,mmap.MAP_RESILIENT_MEDIA
,mmap.MAP_32BIT
,mmap.MAP_TRANSLATED_ALLOW_EXECUTE
,mmap.MAP_UNIX03
andmmap.MAP_TPRO
. All of them aremmap(2)
flags on macOS.gh-113848 [https://github.com/python/cpython/issues/113848]:
asyncio.TaskGroup()
andasyncio.timeout()
context managers now handleCancelledError
subclasses as well as exactCancelledError
.gh-113661 [https://github.com/python/cpython/issues/113661]: unittest runner: Don't exit 5 if tests were skipped. The intention of exiting 5 was to detect issues where the test suite wasn't discovered at all. If we skipped tests, it was correctly discovered.
gh-96037 [https://github.com/python/cpython/issues/96037]: Insert
TimeoutError
in the context of the exception that was raised during exiting an expiredasyncio.timeout()
block.gh-113781 [https://github.com/python/cpython/issues/113781]: Silence unraisable AttributeError when warnings are emitted during Python finalization.
gh-113238 [https://github.com/python/cpython/issues/113238]: Add
Anchor
toimportlib.resources
(in order for the code to comply with the documentation)gh-111693 [https://github.com/python/cpython/issues/111693]:
asyncio.Condition.wait()
now reraises the sameCancelledError
instance that may have caused it to be interrupted. Fixed race condition inasyncio.Semaphore.acquire()
when interrupted with aCancelledError
.gh-113791 [https://github.com/python/cpython/issues/113791]: Add
CLOCK_MONOTONIC_RAW_APPROX
andCLOCK_UPTIME_RAW_APPROX
totime
on macOS. These are clocks available on macOS 10.12 or later.gh-112932 [https://github.com/python/cpython/issues/112932]: Restore the ability for
zipfile
toextractall
from zip files with a "/" directory entry in them as is commonly added to zips by some wiki or bug tracker data exporters.gh-113568 [https://github.com/python/cpython/issues/113568]: Raise deprecation warnings from
pathlib.PurePath
and not its private base classPurePathBase
.gh-113594 [https://github.com/python/cpython/issues/113594]: Fix
UnicodeEncodeError
inemail
when re-fold lines that contain unknown-8bit encoded part followed by non-unknown-8bit encoded part.gh-113538 [https://github.com/python/cpython/issues/113538]: In
asyncio.StreamReaderProtocol.connection_made()
, there is callback that logs an error if the task wrapping the "connected callback" fails. This callback would itself fail if the task was cancelled. Prevent this by checking whether the task was cancelled first. If so, close the transport but don't log an error.gh-113626 [https://github.com/python/cpython/issues/113626]: Add support for the allow_code argument in the
marshal
module. Passingallow_code=False
prevents serialization and deserialization of code objects which is incompatible between Python versions.gh-85567 [https://github.com/python/cpython/issues/85567]: Fix resource warnings for unclosed files in
pickle
andpickletools
command line interfaces.gh-113537 [https://github.com/python/cpython/issues/113537]: Support loads
str
inplistlib.loads()
.gh-89850 [https://github.com/python/cpython/issues/89850]: Add default implementations of
pickle.Pickler.persistent_id()
andpickle.Unpickler.persistent_load()
methods in the C implementation. Callingsuper().persistent_id()
andsuper().persistent_load()
in subclasses of the C implementation ofpickle.Pickler
andpickle.Unpickler
classes no longer causes infinite recursion.gh-113569 [https://github.com/python/cpython/issues/113569]: Indicate if there were no actual calls in unittest
asserthascalls()
failure.gh-101225 [https://github.com/python/cpython/issues/101225]: Increase the backlog for
multiprocessing.connection.Listener
objects created bymultiprocessing.manager
andmultiprocessing.resource_sharer
to significantly reduce the risk of getting a connection refused error when creating amultiprocessing.connection.Connection
to them.gh-113568 [https://github.com/python/cpython/issues/113568]: Raise audit events from
pathlib.Path
and not its private base classPathBase
.gh-113543 [https://github.com/python/cpython/issues/113543]: Make sure that
webbrowser.MacOSXOSAScript
sendswebbrowser.open
audit event.gh-113028 [https://github.com/python/cpython/issues/113028]: When a second reference to a string appears in the input to
pickle
, and the Python implementation is in use, we are guaranteed that a single copy gets pickled and a single object is shared when reloaded. Previously, in protocol 0, when a string contained certain characters (e.g. newline) it resulted in duplicate objects.gh-113421 [https://github.com/python/cpython/issues/113421]: Fix multiprocessing logger for
%(filename)s
.gh-111784 [https://github.com/python/cpython/issues/111784]: Fix segfaults in the
_elementtree
module. Fix first segfault during deallocation of_elementtree.XMLParser
instances by keeping strong reference topyexpat
module in module state for capsule lifetime. Fix second segfault which happens in the same deallocation process by keeping strong reference to_elementtree
module inXMLParser
structure for_elementtree
module lifetime.gh-113407 [https://github.com/python/cpython/issues/113407]: Fix import of
unittest.mock
when CPython is built without docstrings.gh-113320 [https://github.com/python/cpython/issues/113320]: Fix regression in Python 3.12 where
Protocol
classes that were not marked asruntime-checkable
would be unnecessarily introspected, potentially causing exceptions to be raised if the protocol had problematic members. Patch by Alex Waygood.gh-53502 [https://github.com/python/cpython/issues/53502]: Add a new option
aware_datetime
inplistlib
to loads or dumps aware datetime.gh-113358 [https://github.com/python/cpython/issues/113358]: Fix rendering tracebacks with exceptions with a broken getattr
gh-113214 [https://github.com/python/cpython/issues/113214]: Fix an
AttributeError
during asyncio SSL protocol aborts in SSL-over-SSL scenarios.gh-113246 [https://github.com/python/cpython/issues/113246]: Update bundled pip to 23.3.2.
gh-87264 [https://github.com/python/cpython/issues/87264]: Fixed tarfile list() method to show file type.
gh-112182 [https://github.com/python/cpython/issues/112182]:
asyncio.futures.Future.set_exception()
now transformsStopIteration
intoRuntimeError
instead of hanging or other misbehavior. Patch contributed by Jamie Phan.gh-113225 [https://github.com/python/cpython/issues/113225]: Speed up
pathlib.Path.glob()
by usingos.DirEntry.path
where possible.gh-113149 [https://github.com/python/cpython/issues/113149]: Improve error message when a JSON array or object contains a trailing comma. Patch by Carson Radtke.
gh-113117 [https://github.com/python/cpython/issues/113117]: The
subprocess
module can now use theos.posix_spawn()
function withclose_fds=True
on platforms whereposix_spawn_file_actions_addclosefrom_np
is available. Patch by Jakub Kulik.gh-113199 [https://github.com/python/cpython/issues/113199]: Make
http.client.HTTPResponse.read1
andhttp.client.HTTPResponse.readline
close IO after reading all data when content length is known. Patch by Illia Volochii.gh-113191 [https://github.com/python/cpython/issues/113191]: Add support of
os.fchmod()
and a file descriptor inos.chmod()
on Windows.gh-113188 [https://github.com/python/cpython/issues/113188]: Fix
shutil.copymode()
andshutil.copystat()
on Windows. Previously they worked differently if dst is a symbolic link: they modified the permission bits of dst itself rather than the file it points to if follow_symlinks is true or src is not a symbolic link, and did not modify the permission bits if follow_symlinks is false and src is a symbolic link.gh-113119 [https://github.com/python/cpython/issues/113119]:
os.posix_spawn()
now acceptsenv=None
, which makes the newly spawned process use the current process environment. Patch by Jakub Kulik.gh-113202 [https://github.com/python/cpython/issues/113202]: Add a
strict
option tobatched()
in theitertools
module.gh-61648 [https://github.com/python/cpython/issues/61648]: Detect line numbers of properties in doctests.
gh-113175 [https://github.com/python/cpython/issues/113175]: Sync with importlibmetadata 7.0, including improved type annotations, fixed issue with symlinked packages in
package_distributions
, addedEntryPoints._repr\
, introduced thediagnose
script, addedDistribution.origin
property, and removed deprecatedEntryPoint
access by numeric index (tuple behavior).gh-59616 [https://github.com/python/cpython/issues/59616]: Add support of
os.lchmod()
and the follow_symlinks argument inos.chmod()
on Windows. Note that the default value of follow_symlinks inos.lchmod()
isFalse
on Windows.gh-112559 [https://github.com/python/cpython/issues/112559]:
signal.signal()
andsignal.getsignal()
no longer callrepr
on callable handlers.asyncio.run()
andasyncio.Runner.run()
no longer callrepr
on the task results. Patch by Yilei Yang.gh-112962 [https://github.com/python/cpython/issues/112962]:
dis
module functions add cache information to theInstruction
instance rather than creating fakeInstruction
instances to represent the cache entries.gh-112989 [https://github.com/python/cpython/issues/112989]: Reduce overhead to connect sockets with
asyncio
SelectorEventLoop.gh-112970 [https://github.com/python/cpython/issues/112970]: Use
closefrom()
on Linux where available (e.g. glibc-2.34), rather than only FreeBSD.gh-110190 [https://github.com/python/cpython/issues/110190]: Fix ctypes structs with array on PPC64LE platform by setting
MAX_STRUCT_SIZE
to 64 in stgdict. Patch by Diego Russo.gh-112540 [https://github.com/python/cpython/issues/112540]: The statistics.geometric_mean() function now returns zero for datasets containing a zero. Formerly, it would raise an exception.
gh-87286 [https://github.com/python/cpython/issues/87286]: Added
LOG_FTP
,LOG_NETINFO
,LOG_REMOTEAUTH
,LOG_INSTALL
,LOG_RAS
, andLOG_LAUNCHD
tot thesyslog
module, all of them constants on used on macOS.gh-112800 [https://github.com/python/cpython/issues/112800]: Fix
asyncio
SubprocessTransport.close()
not to throwPermissionError
when used with setuid executables.gh-51944 [https://github.com/python/cpython/issues/51944]: Add the following constants to the
termios
module. These values are present in macOS system headers:ALTWERASE
,B14400
,B28800
,B7200
,B76800
,CCAR_OFLOW
,CCTS_OFLOW
,CDSR_OFLOW
,CDTR_IFLOW
,CIGNORE
,CRTS_IFLOW
,EXTPROC
,IUTF8
,MDMBUF
,NL2
,NL3
,NOKERNINFO
,ONOEOT
,OXTABS
,VDSUSP
,VSTATUS
.gh-79325 [https://github.com/python/cpython/issues/79325]: Fix an infinite recursion error in
tempfile.TemporaryDirectory()
cleanup on Windows.gh-94692 [https://github.com/python/cpython/issues/94692]:
shutil.rmtree()
now only catches OSError exceptions. Previously a symlink attack resistant version ofshutil.rmtree()
could ignore or pass to the error handler arbitrary exception when invalid arguments were provided.gh-112736 [https://github.com/python/cpython/issues/112736]: The use of del-safe symbols in
subprocess
was refactored to allow for use in cross-platform build environments.gh-112727 [https://github.com/python/cpython/issues/112727]: Speed up
pathlib.Path.absolute()
. Patch by Barney Gale.gh-74690 [https://github.com/python/cpython/issues/74690]: Speedup
issubclass()
checks against simpleruntime-checkable protocols
by around 6%. Patch by Alex Waygood.gh-74690 [https://github.com/python/cpython/issues/74690]: Speedup
isinstance()
checks by roughly 20% forruntime-checkable protocols
that only have one callable member. Speedupissubclass()
checks for these protocols by roughly 10%. Patch by Alex Waygood.gh-112645 [https://github.com/python/cpython/issues/112645]: Remove deprecation error on passing
onerror
toshutil.rmtree()
.gh-112640 [https://github.com/python/cpython/issues/112640]: Add
kwdefaults
parameter totypes.FunctionType
to set default keyword argument values.gh-112622 [https://github.com/python/cpython/issues/112622]: Ensure
name
parameter is passed to event loop inasyncio.create_task()
.gh-112618 [https://github.com/python/cpython/issues/112618]: Fix a caching bug relating to
typing.Annotated
.Annotated[str, True]
is no longer identical toAnnotated[str, 1]
.gh-112334 [https://github.com/python/cpython/issues/112334]: Fixed a performance regression in 3.12's
subprocess
on Linux where it would no longer use the fastpathvfork()
system call when it could have due to a logic bug, instead falling back to the safe but slowerfork()
.
Also fixed a second 3.12.0 potential security bug. If a value of extra_groups=[]
was passed to subprocess.Popen
or related APIs, the underlying setgroups(0, NULL)
system call to clear the groups list would not be made in the child process prior to exec()
.
This was identified via code inspection in the process of fixing the first bug.
gh-110190 [https://github.com/python/cpython/issues/110190]: Fix ctypes structs with array on Arm platform by setting
MAX_STRUCT_SIZE
to 32 in stgdict. Patch by Diego Russo.gh-81194 [https://github.com/python/cpython/issues/81194]: Fix a crash in
socket.if_indextoname()
with specific value (UINT_MAX). Fix an integer overflow insocket.if_indextoname()
on 64-bit non-Windows platforms.gh-112578 [https://github.com/python/cpython/issues/112578]: Fix a spurious
RuntimeWarning
when executing thezipfile
module.gh-112516 [https://github.com/python/cpython/issues/112516]: Update the bundled copy of pip to version 23.3.1.
gh-112510 [https://github.com/python/cpython/issues/112510]: Add
readline.backend
for the backend readline uses (editline
orreadline
)gh-112328 [https://github.com/python/cpython/issues/112328]: [Enum] Make
EnumDict
,EnumDict.member_names
,EnumType._add_alias_
andEnumType._add_value_alias_
public.gh-112509 [https://github.com/python/cpython/issues/112509]: Fix edge cases that could cause a key to be present in both the
__required_keys__
and__optional_keys__
attributes of atyping.TypedDict
. Patch by Jelle Zijlstra.gh-101336 [https://github.com/python/cpython/issues/101336]: Add
keep_alive
keyword parameter forAbstractEventLoop.create_server()
andBaseEventLoop.create_server()
.gh-63284 [https://github.com/python/cpython/issues/63284]: Added support for TLS-PSK (pre-shared key) mode to the
ssl
module.gh-112414 [https://github.com/python/cpython/issues/112414]: Fix regression in Python 3.12 where calling
repr()
on a module that had been imported using a custom loader could fail withAttributeError
. Patch by Alex Waygood.gh-112358 [https://github.com/python/cpython/issues/112358]: Revert change to
struct.Struct
initialization that broke some cases of subclassing.gh-112405 [https://github.com/python/cpython/issues/112405]: Optimize
pathlib.PurePath.relative_to()
. Patch by Alex Waygood.gh-94722 [https://github.com/python/cpython/issues/94722]: Fix bug where comparison between instances of
DocTest
fails if one of them hasNone
as its lineno.gh-112361 [https://github.com/python/cpython/issues/112361]: Speed up a small handful of
pathlib
methods by removing some temporary objects.gh-112345 [https://github.com/python/cpython/issues/112345]: Improve error message when trying to call
issubclass()
against atyping.Protocol
that has non-method members. Patch by Randolf Scholz.gh-112137 [https://github.com/python/cpython/issues/112137]: Change
dis
output to display no-lineno as "—" instead of "None".gh-112332 [https://github.com/python/cpython/issues/112332]: Deprecate the
exc_type
field oftraceback.TracebackException
. Addexc_type_str
to replace it.gh-81620 [https://github.com/python/cpython/issues/81620]: Add extra tests for
random.binomialvariate()
gh-112292 [https://github.com/python/cpython/issues/112292]: Fix a crash in
readline
when imported from a sub interpreter. Patch by Anthony Shawgh-77621 [https://github.com/python/cpython/issues/77621]: Slightly improve the import time of the
pathlib
module by deferring some imports. Patch by Barney Gale.gh-112137 [https://github.com/python/cpython/issues/112137]: Change
dis
output to display logical labels for jump targets instead of offsets.gh-112139 [https://github.com/python/cpython/issues/112139]: Add
Signature.format()
to format signatures to string with extra options. And use it inpydoc
to render more readable signatures that have new lines between parameters.gh-112105 [https://github.com/python/cpython/issues/112105]: Make
readline.set_completer_delims()
work with libeditgh-106922 [https://github.com/python/cpython/issues/106922]: Display multiple lines with
traceback
when errors span multiple lines.gh-111874 [https://github.com/python/cpython/issues/111874]: When creating a
typing.NamedTuple
class, ensure_setname__()
is called on all objects that define_setname__
and exist in the values of theNamedTuple
class's class dictionary. Patch by Alex Waygood.gh-68166 [https://github.com/python/cpython/issues/68166]: Add support of the "vsapi" element type in
tkinter.ttk.Style.element_create()
.gh-110275 [https://github.com/python/cpython/issues/110275]: Named tuple's methods
_replace()
and__replace__()
now raise TypeError instead of ValueError for invalid keyword arguments.gh-99367 [https://github.com/python/cpython/issues/99367]: Do not mangle
sys.path[0]
inpdb
if safe_path is setgh-111615 [https://github.com/python/cpython/issues/111615]: Fix a regression caused by a fix to gh-93162 [https://github.com/python/cpython/issues/93162] whereby you couldn't configure a
QueueHandler
without specifying handlers.gh-75666 [https://github.com/python/cpython/issues/75666]: Fix the behavior of
tkinter
widget'sunbind()
method with two arguments. Previously,widget.unbind(sequence, funcid)
destroyed the current binding for sequence, leaving sequence unbound, and deleted the funcid command. Now it removes only funcid from the binding for sequence, keeping other commands, and deletes the funcid command. It leaves sequence unbound only if funcid was the last bound command.gh-67790 [https://github.com/python/cpython/issues/67790]: Implement basic formatting support (minimum width, alignment, fill) for
fractions.Fraction
.gh-111049 [https://github.com/python/cpython/issues/111049]: Fix crash during garbage collection of the
io.BytesIO
buffer object.gh-102980 [https://github.com/python/cpython/issues/102980]: Redirect the output of
interact
command ofpdb
to the same channel as the debugger. Add tests and improve docs.gh-102988 [https://github.com/python/cpython/issues/102988]:
email.utils.getaddresses()
andemail.utils.parseaddr()
now return('', '')
2-tuples in more situations where invalid email addresses are encountered instead of potentially inaccurate values. Add optional strict parameter to these two functions: usestrict=False
to get the old behavior, accept malformed inputs.getattr(email.utils, 'supports_strict_parsing', False)
can be use to check if the strict parameter is available. Patch by Thomas Dwyer and Victor Stinner to improve the CVE 2023-27043 [https://www.cve.org/CVERecord?id=CVE-2023-27043] fix.gh-52161 [https://github.com/python/cpython/issues/52161]:
cmd.Cmd.do_help()
now cleans docstrings withinspect.cleandoc()
before writing them. Patch by Filip Łapkiewicz.gh-82300 [https://github.com/python/cpython/issues/82300]: Add
track
parameter tomultiprocessing.shared_memory.SharedMemory
that allows using shared memory blocks without having to register with the POSIX resource tracker that automatically releases them upon process exit.gh-110109 [https://github.com/python/cpython/issues/110109]: Add private
pathlib._PurePathBase
class: a base class forpathlib.PurePath
that omits certain magic methods. It may be made public (along with_PathBase
) in future.gh-109858 [https://github.com/python/cpython/issues/109858]: Protect
zipfile
from "quoted-overlap" zipbomb. It now raises BadZipFile when try to read an entry that overlaps with other entry or central directory.gh-109786 [https://github.com/python/cpython/issues/109786]: Fix possible reference leaks and crash when reenter the
__next__()
method ofitertools.pairwise
.gh-91539 [https://github.com/python/cpython/issues/91539]: Small (10 - 20%) and trivial performance improvement of
urllib.request.getproxies_environment()
, typically useful when there are many environment variables to go over.gh-103363 [https://github.com/python/cpython/issues/103363]: Add follow_symlinks keyword-only argument to
pathlib.Path.owner()
andgroup()
, defaulting toTrue
.gh-102130 [https://github.com/python/cpython/issues/102130]: Support tab completion in
cmd
foreditline
.gh-99437 [https://github.com/python/cpython/issues/99437]:
runpy.run_path()
now decodes pathlike objects, making sure file and sys.argv[0] of the module being run are always strings.gh-104003 [https://github.com/python/cpython/issues/104003]: Add
warnings.deprecated()
, a decorator to mark deprecated functions to static type checkers and to warn on usage of deprecated classes and functions. See PEP 702 [https://peps.python.org/pep-0702/]. Patch by Jelle Zijlstra.gh-103708 [https://github.com/python/cpython/issues/103708]: Make hardcoded python name, a configurable parameter so that different implementations of python can override it instead of making huge diffs in sysconfig.py
gh-66515 [https://github.com/python/cpython/issues/66515]:
mailbox.MH
now supports folders that do not contain a.mh_sequences
file (e.g. Claws Mail IMAP-cache folders). Patch by Serhiy Storchaka.gh-83162 [https://github.com/python/cpython/issues/83162]: Renamed
re.error
toPatternError
for clarity, and keptre.error
for backward compatibility. Patch by Matthias Bussonnier and Adam Chhina.gh-91133 [https://github.com/python/cpython/issues/91133]: Fix a bug in
tempfile.TemporaryDirectory
cleanup, which now no longer dereferences symlinks when working around file system permission errors.bpo-43153 [https://bugs.python.org/issue?@action=redirect&bpo=43153]: On Windows,
tempfile.TemporaryDirectory
previously masked aPermissionError
withNotADirectoryError
during directory cleanup. It now correctly raisesPermissionError
if errors are not ignored. Patch by Andrei Kulakov and Ken Jin.bpo-32731 [https://bugs.python.org/issue?@action=redirect&bpo=32731]:
getpass.getuser()
now raisesOSError
for all failures rather thanImportError
on systems lacking thepwd
module orKeyError
if the password database is empty.bpo-34321 [https://bugs.python.org/issue?@action=redirect&bpo=34321]:
mmap.mmap
now has a trackfd parameter on Unix; if it isFalse
, the file descriptor specified by fileno will not be duplicated.bpo-35332 [https://bugs.python.org/issue?@action=redirect&bpo=35332]: The
shutil.rmtree()
function now ignores errors when callingos.close()
when ignore_errors isTrue
, andos.close()
no longer retried after error.bpo-35928 [https://bugs.python.org/issue?@action=redirect&bpo=35928]:
io.TextIOWrapper
now correctly handles the decoding buffer afterread()
andwrite()
.bpo-26791 [https://bugs.python.org/issue?@action=redirect&bpo=26791]:
shutil.move()
now moves a symlink into a directory when that directory is the target of the symlink. This provides the same behavior as the mv shell command. The previous behavior raised an exception. Patch by Jeffrey Kintscher.bpo-41422 [https://bugs.python.org/issue?@action=redirect&bpo=41422]: Fixed memory leaks of
pickle.Pickler
andpickle.Unpickler
involving cyclic references via the internal memo mapping.bpo-19821 [https://bugs.python.org/issue?@action=redirect&bpo=19821]: The
pydoc.ispackage()
function has been deprecated.bpo-40262 [https://bugs.python.org/issue?@action=redirect&bpo=40262]: The
ssl.SSLSocket.recv_into()
method no longer requires the buffer argument to implement__len__
and supports buffers with arbitrary item size.bpo-39912 [https://bugs.python.org/issue?@action=redirect&bpo=39912]:
warnings.filterwarnings()
andwarnings.simplefilter()
now raise appropriate exceptions instead ofAssertionError
. Patch contributed by Rémi Lapeyre.bpo-37260 [https://bugs.python.org/issue?@action=redirect&bpo=37260]: Fixed a race condition in
shutil.rmtree()
in which directory entries removed by another process or thread whileshutil.rmtree()
is running can cause it to raise FileNotFoundError. Patch by Jeffrey Kintscher.bpo-36959 [https://bugs.python.org/issue?@action=redirect&bpo=36959]: Fix some error messages for invalid ISO format string combinations in
strptime()
that referred to directives not contained in the format string. Patch by Gordon P. Hemsley.bpo-18060 [https://bugs.python.org/issue?@action=redirect&bpo=18060]: Fixed a class inheritance issue that can cause segfaults when deriving two or more levels of subclasses from a base class of Structure or Union.
bpo-29779 [https://bugs.python.org/issue?@action=redirect&bpo=29779]: Add a new
PYTHON_HISTORY
environment variable to set the location of a.python_history
file.bpo-21360 [https://bugs.python.org/issue?@action=redirect&bpo=21360]:
mailbox.Maildir
now ignores files with a leading dot.