C API
bpo-29103 [https://bugs.python.org/issue?@action=redirect&bpo=29103]:
PyType_FromSpec*
now copies the class name from the spec to a buffer owned by the class, so the original can be safely deallocated. Patch by Petr Viktorin.bpo-45522 [https://bugs.python.org/issue?@action=redirect&bpo=45522]: The internal freelists for frame, float, list, dict, async generators, and context objects can now be disabled.
bpo-35134 [https://bugs.python.org/issue?@action=redirect&bpo=35134]: Exclude
PyWeakref_GET_OBJECT()
from the limited C API. It never worked since thePyWeakReference
structure is opaque in the limited C API.bpo-35081 [https://bugs.python.org/issue?@action=redirect&bpo=35081]: Move the
interpreteridobject.h
header file fromInclude/
toInclude/internal/
. It only provides private functions. Patch by Victor Stinner.bpo-35134 [https://bugs.python.org/issue?@action=redirect&bpo=35134]: The non-limited API files
cellobject.h
,classobject.h
,context.h
,funcobject.h
,genobject.h
andlongintrepr.h
have been moved to theInclude/cpython
directory. Moreover, theeval.h
header file was removed. These files must not be included directly, as they are already included inPython.h
: Include Files. If they have been included directly, consider includingPython.h
instead. Patch by Victor Stinner.bpo-45474 [https://bugs.python.org/issue?@action=redirect&bpo=45474]: The following items are no longer available when
Py_LIMITED_API
is defined:
这些不是 受限 API 的组成部分。
Patch by Victor Stinner.
bpo-45434 [https://bugs.python.org/issue?@action=redirect&bpo=45434]: Remove the
pystrhex.h
header file. It only contains private functions. C extensions should only include the main
header file. Patch by Victor Stinner.bpo-45440 [https://bugs.python.org/issue?@action=redirect&bpo=45440]: Remove the
Py_FORCE_DOUBLE()
macro. It was used by thePy_IS_INFINITY()
macro. Patch by Victor Stinner.bpo-45434 [https://bugs.python.org/issue?@action=redirect&bpo=45434]:
no longer includes the header files
,
,
and
when thePy_LIMITED_API
macro is set to0x030b0000
(Python 3.11) or higher. C extensions should explicitly include the header files after#include
. Patch by Victor Stinner.bpo-41123 [https://bugs.python.org/issue?@action=redirect&bpo=41123]: Remove
Py_UNICODE_COPY()
andPy_UNICODE_FILL()
macros, deprecated since Python 3.3. UsePyUnicode_CopyCharacters()
ormemcpy()
(wchar_t*
string), andPyUnicode_Fill()
functions instead. Patch by Victor Stinner.bpo-45412 [https://bugs.python.org/issue?@action=redirect&bpo=45412]: Remove the following math macros using the
errno
variable:Py_ADJUST_ERANGE1()
Py_ADJUST_ERANGE2()
Py_OVERFLOWED()
Py_SET_ERANGE_IF_OVERFLOW()
Py_SET_ERRNO_ON_MATH_ERROR()
Patch by Victor Stinner.
bpo-45395 [https://bugs.python.org/issue?@action=redirect&bpo=45395]: Custom frozen modules (the array set to
PyImport_FrozenModules
) are now treated as additions, rather than replacing all the default frozen modules. Frozen stdlib modules can still be disabled by setting the "code" field of the custom array entry to NULL.bpo-43760 [https://bugs.python.org/issue?@action=redirect&bpo=43760]: Add new
PyThreadState_EnterTracing()
, andPyThreadState_LeaveTracing()
functions to the limited C API to suspend and resume tracing and profiling. Patch by Victor Stinner.bpo-44220 [https://bugs.python.org/issue?@action=redirect&bpo=44220]:
PyStructSequence_UnnamedField
is added to the Stable ABI.
Python 3.11.0 alpha 1
Release date: 2021-10-05
安全性
bpo-42278 [https://bugs.python.org/issue?@action=redirect&bpo=42278]: Replaced usage of
tempfile.mktemp()
withTemporaryDirectory
to avoid a potential race condition.bpo-44600 [https://bugs.python.org/issue?@action=redirect&bpo=44600]: Fix incorrect line numbers while tracing some failed patterns in match statements. Patch by Charles Burkland.
bpo-41180 [https://bugs.python.org/issue?@action=redirect&bpo=41180]: Add auditing events to the
marshal
module, and stop raisingcode.__init__
events for every unmarshalled code object. Directly instantiated code objects will continue to raise an event, and audit event handlers should inspect or collect the raw marshal data. This reduces a significant performance overhead when loading from.pyc
files.bpo-44394 [https://bugs.python.org/issue?@action=redirect&bpo=44394]: Update the vendored copy of libexpat to 2.4.1 (from 2.2.8) to get the fix for the CVE 2013-0340 [https://www.cve.org/CVERecord?id=CVE-2013-0340] "Billion Laughs" vulnerability. This copy is most used on Windows and macOS.
bpo-43124 [https://bugs.python.org/issue?@action=redirect&bpo=43124]: Made the internal
putcmd
function insmtplib
sanitize input for presence of\r
and\n
characters to avoid (unlikely) command injection.bpo-44022 [https://bugs.python.org/issue?@action=redirect&bpo=44022]:
http.client
now avoids infinitely reading potential HTTP headers after a100 Continue
status response from the server.
核心与内置函数
bpo-43760 [https://bugs.python.org/issue?@action=redirect&bpo=43760]: The number of hardware branches per instruction dispatch is reduced from two to one by adding a special instruction for tracing. Patch by Mark Shannon.
bpo-45061 [https://bugs.python.org/issue?@action=redirect&bpo=45061]: Add a deallocator to the bool type to detect refcount bugs in C extensions which call Py_DECREF(Py_True) or Py_DECREF(Py_False) by mistake. Detect also refcount bugs when the empty tuple singleton or the Unicode empty string singleton is destroyed by mistake. Patch by Victor Stinner.
bpo-24076 [https://bugs.python.org/issue?@action=redirect&bpo=24076]: sum() was further optimised for summing up single digit integers.
bpo-45190 [https://bugs.python.org/issue?@action=redirect&bpo=45190]: Update Unicode databases to Unicode 14.0.0.
bpo-45167 [https://bugs.python.org/issue?@action=redirect&bpo=45167]: Fix deepcopying of
types.GenericAlias
objects.bpo-45155 [https://bugs.python.org/issue?@action=redirect&bpo=45155]:
int.to_bytes()
andint.from_bytes()
now take a default value of"big"
for thebyteorder
argument.int.to_bytes()
also takes a default value of1
for thelength
argument.bpo-44219 [https://bugs.python.org/issue?@action=redirect&bpo=44219]: Release the GIL while performing
isatty
system calls on arbitrary file descriptors. In particular, this affectsos.isatty()
,os.device_encoding()
andio.TextIOWrapper
. By extension,io.open()
in text mode is also affected. This change solves a deadlock inos.isatty()
. Patch by Vincent Michel in bpo-44219 [https://bugs.python.org/issue?@action=redirect&bpo=44219].bpo-44959 [https://bugs.python.org/issue?@action=redirect&bpo=44959]: Added fallback to extension modules with '.sl' suffix on HP-UX
bpo-45121 [https://bugs.python.org/issue?@action=redirect&bpo=45121]: Fix issue where
Protocol.__init__
raisesRecursionError
when it's called directly or viasuper()
. Patch provided by Yurii Karabas.bpo-44348 [https://bugs.python.org/issue?@action=redirect&bpo=44348]: The deallocator function of the
BaseException
type now uses the trashcan mechanism to prevent stack overflow. For example, when aRecursionError
instance is raised, it can be linked to another RecursionError through the__context__
attribute or the__traceback__
attribute, and then a chain of exceptions is created. When the chain is destroyed, nested deallocator function calls can crash with a stack overflow if the chain is too long compared to the available stack memory. Patch by Victor Stinner.bpo-45123 [https://bugs.python.org/issue?@action=redirect&bpo=45123]: Fix PyAiterCheck to only check for the anext presence (not for _aiter). Rename PyAiter_Check to PyAIter_Check, PyObject_GetAiter -> PyObject_GetAIter.
bpo-1514420 [https://bugs.python.org/issue?@action=redirect&bpo=1514420]: Interpreter no longer attempts to open files with names in angle brackets (like "
" or " ") when formatting an exception. bpo-41031 [https://bugs.python.org/issue?@action=redirect&bpo=41031]: Match C and Python code formatting of unprintable exceptions and exceptions in the
__main__
module.bpo-37330 [https://bugs.python.org/issue?@action=redirect&bpo=37330]:
open()
,io.open()
,codecs.open()
andfileinput.FileInput
no longer accept'U'
("universal newline") in the file mode. This flag was deprecated since Python 3.3. Patch by Victor Stinner.bpo-45083 [https://bugs.python.org/issue?@action=redirect&bpo=45083]: When the interpreter renders an exception, its name now has a complete qualname. Previously only the class name was concatenated to the module name, which sometimes resulted in an incorrect full name being displayed.
(This issue impacted only the C code exception rendering, the traceback
module was using qualname already).
bpo-34561 [https://bugs.python.org/issue?@action=redirect&bpo=34561]: List sorting now uses the merge-ordering strategy from Munro and Wild's
powersort()
. Unlike the former strategy, this is provably near-optimal in the entropy of the distribution of run lengths. Most uses oflist.sort()
probably won't see a significant time difference, but may see significant improvements in cases where the former strategy was exceptionally poor. However, as these are all fast linear-time approximations to a problem that's inherently at best quadratic-time to solve truly optimally, it's also possible to contrive cases where the former strategy did better.bpo-45056 [https://bugs.python.org/issue?@action=redirect&bpo=45056]: Compiler now removes trailing unused constants from co_consts.
bpo-45020 [https://bugs.python.org/issue?@action=redirect&bpo=45020]: Add a new command line option, "-X frozen_modules=[on|off]" to opt out of (or into) using optional frozen modules. This defaults to "on" (or "off" if it's running out of the source tree).
bpo-45012 [https://bugs.python.org/issue?@action=redirect&bpo=45012]: In
posix
, release GIL duringstat()
,lstat()
, andfstatat()
syscalls made byos.DirEntry.stat()
. Patch by Stanisław Skonieczny.bpo-45018 [https://bugs.python.org/issue?@action=redirect&bpo=45018]: Fixed pickling of range iterators that iterated for over
2**32
times.bpo-45000 [https://bugs.python.org/issue?@action=redirect&bpo=45000]: A
SyntaxError
is now raised when trying to delete__debug__
. Patch by Donghee Na.bpo-44963 [https://bugs.python.org/issue?@action=redirect&bpo=44963]: Implement
send()
andthrow()
methods foranext_awaitable
objects. Patch by Pablo Galindo.bpo-44962 [https://bugs.python.org/issue?@action=redirect&bpo=44962]: Fix a race in WeakKeyDictionary, WeakValueDictionary and WeakSet when two threads attempt to commit the last pending removal. This fixes asyncio.create_task and fixes a data loss in asyncio.run where shutdown_asyncgens is not run
bpo-24234 [https://bugs.python.org/issue?@action=redirect&bpo=24234]: Implement the
__bytes__()
special method on thebytes
type, so a bytes objectb
passes anisinstance(b, typing.SupportsBytes)
check.bpo-24234 [https://bugs.python.org/issue?@action=redirect&bpo=24234]: Implement the
__complex__()
special method on thecomplex
type, so a complex numberz
passes anisinstance(z, typing.SupportsComplex)
check.bpo-44954 [https://bugs.python.org/issue?@action=redirect&bpo=44954]: Fixed a corner case bug where the result of
float.fromhex('0x.8p-1074')
was rounded the wrong way.bpo-44947 [https://bugs.python.org/issue?@action=redirect&bpo=44947]: Refine the syntax error for trailing commas in import statements. Patch by Pablo Galindo.
bpo-44945 [https://bugs.python.org/issue?@action=redirect&bpo=44945]: Specialize the BINARY_ADD instruction using the PEP 659 machinery. Adds five new instructions:
BINARY_ADD_ADAPTIVE
BINARY_ADD_FLOAT
BINARY_ADD_INT
BINARY_ADD_UNICODE
BINARY_ADD_UNICODE_INPLACE_FAST
bpo-44929 [https://bugs.python.org/issue?@action=redirect&bpo=44929]: Fix some edge cases of
enum.Flag
string representation in the REPL. Patch by Pablo Galindo.bpo-44914 [https://bugs.python.org/issue?@action=redirect&bpo=44914]: Class version tags are no longer recycled.
This means that a version tag serves as a unique identifier for the state of a class. We rely on this for effective specialization of the LOAD_ATTR and other instructions.
bpo-44698 [https://bugs.python.org/issue?@action=redirect&bpo=44698]: Restore behaviour of complex exponentiation with integer-valued exponent of type
float
orcomplex
.bpo-44895 [https://bugs.python.org/issue?@action=redirect&bpo=44895]: A debug variable
PYTHONDUMPREFSFILE
is added for creating a dump file which is generated by--with-trace-refs
. Patch by Donghee Na.bpo-44900 [https://bugs.python.org/issue?@action=redirect&bpo=44900]: Add five superinstructions for PEP 659 quickening:
LOAD_FAST LOAD_FAST
STORE_FAST LOAD_FAST
LOAD_FAST LOAD_CONST
LOAD_CONST LOAD_FAST
STORE_FAST STORE_FAST
bpo-44889 [https://bugs.python.org/issue?@action=redirect&bpo=44889]: Initial implementation of adaptive specialization of
LOAD_METHOD
. The following specialized forms were added:LOAD_METHOD_CACHED
LOAD_METHOD_MODULE
LOAD_METHOD_CLASS
bpo-44890 [https://bugs.python.org/issue?@action=redirect&bpo=44890]: Specialization stats are always collected in debug builds.
bpo-44885 [https://bugs.python.org/issue?@action=redirect&bpo=44885]: Correct the ast locations of fstrings with format specs and repeated expressions. Patch by Pablo Galindo
bpo-44878 [https://bugs.python.org/issue?@action=redirect&bpo=44878]: Remove the loop from the bytecode interpreter. All instructions end with a DISPATCH macro, so the loop is now redundant.
bpo-44878 [https://bugs.python.org/issue?@action=redirect&bpo=44878]: Remove switch statement for interpreter loop when using computed gotos. This makes sure that we only have one dispatch table in the interpreter.
bpo-44874 [https://bugs.python.org/issue?@action=redirect&bpo=44874]: Deprecate the old trashcan macros (
Py_TRASHCAN_SAFE_BEGIN
/Py_TRASHCAN_SAFE_END
). They should be replaced by the new macrosPy_TRASHCAN_BEGIN
andPy_TRASHCAN_END
.bpo-44872 [https://bugs.python.org/issue?@action=redirect&bpo=44872]: Use new trashcan macros (Py_TRASHCAN_BEGIN/END) in frameobject.c instead of the old ones (Py_TRASHCAN_SAFE_BEGIN/END).
bpo-33930 [https://bugs.python.org/issue?@action=redirect&bpo=33930]: Fix segmentation fault with deep recursion when cleaning method objects. Patch by Augusto Goulart and Pablo Galindo.
bpo-25782 [https://bugs.python.org/issue?@action=redirect&bpo=25782]: Fix bug where
PyErr_SetObject
hangs when the current exception has a cycle in its context chain.bpo-44856 [https://bugs.python.org/issue?@action=redirect&bpo=44856]: Fix reference leaks in the error paths of
update_bases()
and__build_class__
. Patch by Pablo Galindo.bpo-44826 [https://bugs.python.org/issue?@action=redirect&bpo=44826]: Initial implementation of adaptive specialization of STORE_ATTR
Three specialized forms of STORE_ATTR are added:
STORE_ATTR_SLOT
STORE_ATTR_SPLIT_KEYS
STORE_ATTR_WITH_HINT
bpo-44838 [https://bugs.python.org/issue?@action=redirect&bpo=44838]: Fixed a bug that was causing the parser to raise an incorrect custom
SyntaxError
for invalid 'if' expressions. Patch by Pablo Galindo.bpo-44821 [https://bugs.python.org/issue?@action=redirect&bpo=44821]: Create instance dictionaries (dict) eagerly, to improve regularity of object layout and assist specialization.
bpo-44792 [https://bugs.python.org/issue?@action=redirect&bpo=44792]: Improve syntax errors for if expressions. Patch by Miguel Brito
bpo-34013 [https://bugs.python.org/issue?@action=redirect&bpo=34013]: Generalize the invalid legacy statement custom error message (like the one generated when "print" is called without parentheses) to include more generic expressions. Patch by Pablo Galindo
bpo-44732 [https://bugs.python.org/issue?@action=redirect&bpo=44732]: Rename
types.Union
totypes.UnionType
.bpo-44725 [https://bugs.python.org/issue?@action=redirect&bpo=44725]: Expose specialization stats in python via
opcode.getspecialization_stats()
.bpo-44717 [https://bugs.python.org/issue?@action=redirect&bpo=44717]: Improve AttributeError on circular imports of submodules.
bpo-44698 [https://bugs.python.org/issue?@action=redirect&bpo=44698]: Fix undefined behaviour in complex object exponentiation.
bpo-44653 [https://bugs.python.org/issue?@action=redirect&bpo=44653]: Support
typing
types in parameter substitution in the union type.bpo-44676 [https://bugs.python.org/issue?@action=redirect&bpo=44676]: Add ability to serialise
types.Union
objects. Patch provided by Yurii Karabas.bpo-44633 [https://bugs.python.org/issue?@action=redirect&bpo=44633]: Parameter substitution of the union type with wrong types now raises
TypeError
instead of returningNotImplemented
.bpo-44661 [https://bugs.python.org/issue?@action=redirect&bpo=44661]: Update
property_descr_set
to use vectorcall if possible. Patch by Donghee Na.bpo-44662 [https://bugs.python.org/issue?@action=redirect&bpo=44662]: Add
__module__
totypes.Union
. This also fixestypes.Union
issues withtyping.Annotated
. Patch provided by Yurii Karabas.bpo-44655 [https://bugs.python.org/issue?@action=redirect&bpo=44655]: Include the name of the type in unset slots attribute errors. Patch by Pablo Galindo
bpo-44655 [https://bugs.python.org/issue?@action=redirect&bpo=44655]: Don't include a missing attribute with the same name as the failing one when offering suggestions for missing attributes. Patch by Pablo Galindo
bpo-44646 [https://bugs.python.org/issue?@action=redirect&bpo=44646]: Fix the hash of the union type: it no longer depends on the order of arguments.
bpo-44636 [https://bugs.python.org/issue?@action=redirect&bpo=44636]: Collapse union of equal types. E.g. the result of
int | int
is nowint
. Fix comparison of the union type with nonhashable objects. E.g.int | str == {}
no longer raises a TypeError.bpo-44611 [https://bugs.python.org/issue?@action=redirect&bpo=44611]: On Windows,
os.urandom()
: uses BCryptGenRandom API instead of CryptGenRandom API which is deprecated from Microsoft Windows API. Patch by Donghee Na.bpo-44635 [https://bugs.python.org/issue?@action=redirect&bpo=44635]: Convert
None
totype(None)
in the union type constructor.bpo-26280 [https://bugs.python.org/issue?@action=redirect&bpo=26280]: Implement adaptive specialization for BINARY_SUBSCR
Three specialized forms of BINARY_SUBSCR are added:
BINARY_SUBSCR_LIST_INT
BINARY_SUBSCR_TUPLE_INT
BINARY_SUBSCR_DICT
bpo-44589 [https://bugs.python.org/issue?@action=redirect&bpo=44589]: Mapping patterns in
match
statements with two or more equal literal keys will now raise aSyntaxError
at compile-time.bpo-44606 [https://bugs.python.org/issue?@action=redirect&bpo=44606]: Fix
__instancecheck__
and__subclasscheck__
for the union type.bpo-42073 [https://bugs.python.org/issue?@action=redirect&bpo=42073]: The
@classmethod
decorator can now wrap other classmethod-like descriptors.bpo-41972 [https://bugs.python.org/issue?@action=redirect&bpo=41972]: Tuned the string-searching algorithm of fastsearch.h to have a shorter inner loop for most cases.
bpo-44590 [https://bugs.python.org/issue?@action=redirect&bpo=44590]: All necessary data for executing a Python function (local variables, stack, etc) is now kept in a per-thread stack. Frame objects are lazily allocated on demand. This increases performance by about 7% on the standard benchmark suite. Introspection and debugging are unaffected as frame objects are always available when needed. Patch by Mark Shannon.
bpo-44584 [https://bugs.python.org/issue?@action=redirect&bpo=44584]: The threading debug (
PYTHONTHREADDEBUG
environment variable) is deprecated in Python 3.10 and will be removed in Python 3.12. This feature requires a debug build of Python. Patch by Victor Stinner.bpo-43895 [https://bugs.python.org/issue?@action=redirect&bpo=43895]: An obsolete internal cache of shared object file handles added in 1995 that attempted, but did not guarantee, that a .so would not be dlopen'ed twice to work around flaws in mid-1990s posix-ish operating systems has been removed from dynload_shlib.c.
bpo-44490 [https://bugs.python.org/issue?@action=redirect&bpo=44490]:
typing
now searches for type parameters intypes.Union
objects.get_type_hints
will also properly resolve annotations with nestedtypes.Union
objects. Patch provided by Yurii Karabas.bpo-43950 [https://bugs.python.org/issue?@action=redirect&bpo=43950]: Code objects can now provide the column information for instructions when available. This is levaraged during traceback printing to show the expressions responsible for errors.
Contributed by Pablo Galindo, Batuhan Taskaya and Ammar Askar as part of PEP 657 [https://peps.python.org/pep-0657/].
bpo-44562 [https://bugs.python.org/issue?@action=redirect&bpo=44562]: Remove uses of
PyObject_GC_Del()
in error path when initializingtypes.GenericAlias
.bpo-41486 [https://bugs.python.org/issue?@action=redirect&bpo=41486]: Fix a memory consumption and copying performance regression in earlier 3.10 beta releases if someone used an output buffer larger than 4GiB with zlib.decompress on input data that expands that large.
bpo-43908 [https://bugs.python.org/issue?@action=redirect&bpo=43908]: Heap types with the
Py_TPFLAGS_IMMUTABLETYPE
flag can now inherit the PEP 590 [https://peps.python.org/pep-0590/] vectorcall protocol. Previously, this was only possible for static types. Patch by Erlend E. Aasland.bpo-44553 [https://bugs.python.org/issue?@action=redirect&bpo=44553]: Implement GC methods for
types.Union
to break reference cycles and prevent memory leaks.bpo-44490 [https://bugs.python.org/issue?@action=redirect&bpo=44490]: Add
__parameters__
attribute and__getitem__
operator totypes.Union
. Patch provided by Yurii Karabas.bpo-44523 [https://bugs.python.org/issue?@action=redirect&bpo=44523]: Remove the pass-through for
hash()
ofweakref.proxy
objects to prevent unintended consequences when the original referred object dies while the proxy is part of a hashable object. Patch by Pablo Galindo.bpo-44483 [https://bugs.python.org/issue?@action=redirect&bpo=44483]: Fix a crash in
types.Union
objects when creating a union of an object with bad__module__
field.bpo-44486 [https://bugs.python.org/issue?@action=redirect&bpo=44486]: Modules will always have a dictionary, even when created by
types.ModuleType._new_()
bpo-44472 [https://bugs.python.org/issue?@action=redirect&bpo=44472]: Fix ltrace functionality when exceptions are raised. Patch by Pablo Galindo
bpo-12022 [https://bugs.python.org/issue?@action=redirect&bpo=12022]: A
TypeError
is now raised instead of anAttributeError
inwith
andasync with
statements for objects which do not support the context manager or asynchronous context manager protocols correspondingly.bpo-44297 [https://bugs.python.org/issue?@action=redirect&bpo=44297]: Make sure that the line number is set when entering a comprehension scope. This ensures that backtraces including generator expressions show the correct line number.
bpo-44456 [https://bugs.python.org/issue?@action=redirect&bpo=44456]: Improve the syntax error when mixing positional and keyword patterns. Patch by Pablo Galindo.
bpo-44409 [https://bugs.python.org/issue?@action=redirect&bpo=44409]: Fix error location information for tokenizer errors raised on initialization of the tokenizer. Patch by Pablo Galindo.
bpo-44396 [https://bugs.python.org/issue?@action=redirect&bpo=44396]: Fix a possible crash in the tokenizer when raising syntax errors for unclosed strings. Patch by Pablo Galindo.
bpo-44376 [https://bugs.python.org/issue?@action=redirect&bpo=44376]: Exact integer exponentiation (like
i**2
orpow(i, 2)
) with a small exponent is much faster, due to reducing overhead in such cases.bpo-44313 [https://bugs.python.org/issue?@action=redirect&bpo=44313]: Directly imported objects and modules (through import and from import statements) don't generate
LOAD_METHOD
/CALL_METHOD
for directly accessed objects on their namespace. They now use the regularLOAD_ATTR
/CALL_FUNCTION
.bpo-44338 [https://bugs.python.org/issue?@action=redirect&bpo=44338]: Implement adaptive specialization for LOAD_GLOBAL
Two specialized forms of LOAD_GLOBAL are added:
LOAD_GLOBAL_MODULE
LOAD_GLOBAL_BUILTIN
bpo-44368 [https://bugs.python.org/issue?@action=redirect&bpo=44368]: Improve syntax errors for invalid "as" targets. Patch by Pablo Galindo
bpo-44349 [https://bugs.python.org/issue?@action=redirect&bpo=44349]: Fix an edge case when displaying text from files with encoding in syntax errors. Patch by Pablo Galindo.
bpo-44337 [https://bugs.python.org/issue?@action=redirect&bpo=44337]: Initial implementation of adaptive specialization of LOAD_ATTR
Four specialized forms of LOAD_ATTR are added:
LOAD_ATTR_SLOT
LOAD_ATTR_SPLIT_KEYS
LOAD_ATTR_WITH_HINT
LOAD_ATTR_MODULE
bpo-44335 [https://bugs.python.org/issue?@action=redirect&bpo=44335]: Fix a regression when identifying incorrect characters in syntax errors. Patch by Pablo Galindo
bpo-43693 [https://bugs.python.org/issue?@action=redirect&bpo=43693]: Computation of the offsets of cell variables is done in the compiler instead of at runtime. This reduces the overhead of handling cell and free variables, especially in the case where a variable is both an argument and cell variable.
bpo-44317 [https://bugs.python.org/issue?@action=redirect&bpo=44317]: Improve tokenizer error with improved locations. Patch by Pablo Galindo.
bpo-44304 [https://bugs.python.org/issue?@action=redirect&bpo=44304]: Fix a crash in the
sqlite3
module that happened when the garbage collector clearssqlite.Statement
objects. Patch by Pablo Galindobpo-44305 [https://bugs.python.org/issue?@action=redirect&bpo=44305]: Improve error message for
try
blocks withoutexcept
orfinally
blocks. Patch by Pablo Galindo.bpo-43413 [https://bugs.python.org/issue?@action=redirect&bpo=43413]: Constructors of subclasses of some builtin classes (e.g.
tuple
,list
,frozenset
) no longer accept arbitrary keyword arguments. [reverted in 3.11a4] Subclass ofset
can now define a_new_()
method with additional keyword parameters without overriding also__init__()
.bpo-43667 [https://bugs.python.org/issue?@action=redirect&bpo=43667]: Improve Unicode support in non-UTF locales on Oracle Solaris. This issue does not affect other Solaris systems.
bpo-43693 [https://bugs.python.org/issue?@action=redirect&bpo=43693]: A new opcode MAKE_CELL has been added that effectively moves some of the work done on function entry into the compiler and into the eval loop. In addition to creating the required cell objects, the new opcode converts relevant arguments (and other locals) to cell variables on function entry.
bpo-44232 [https://bugs.python.org/issue?@action=redirect&bpo=44232]: Fix a regression in
type()
when a metaclass raises an exception. The C functiontype_new()
must properly report the exception when a metaclass constructor raises an exception and the winner class is not the metaclass. Patch by Victor Stinner.bpo-44201 [https://bugs.python.org/issue?@action=redirect&bpo=44201]: Avoid side effects of checking for specialized syntax errors in the REPL that was causing it to ask for extra tokens after a syntax error had been detected. Patch by Pablo Galindo
bpo-43693 [https://bugs.python.org/issue?@action=redirect&bpo=43693]:
PyCodeObject
gainedco_fastlocalnames
andco_fastlocalkinds
as the authoritative source of fast locals info. Marshaled code objects have changed accordingly.bpo-44184 [https://bugs.python.org/issue?@action=redirect&bpo=44184]: Fix a crash at Python exit when a deallocator function removes the last strong reference to a heap type. Patch by Victor Stinner.
bpo-44187 [https://bugs.python.org/issue?@action=redirect&bpo=44187]: Implement quickening in the interpreter. This offers no advantages as yet, but is an enabler of future optimizations. See PEP 659 for full explanation.
bpo-44180 [https://bugs.python.org/issue?@action=redirect&bpo=44180]: The parser doesn't report generic syntax errors that happen in a position further away that the one it reached in the first pass. Patch by Pablo Galindo
bpo-44168 [https://bugs.python.org/issue?@action=redirect&bpo=44168]: Fix error message in the parser involving keyword arguments with invalid expressions. Patch by Pablo Galindo
bpo-44156 [https://bugs.python.org/issue?@action=redirect&bpo=44156]: String caches in
compile.c
are now subinterpreter compatible.bpo-44143 [https://bugs.python.org/issue?@action=redirect&bpo=44143]: Fixed a crash in the parser that manifest when raising tokenizer errors when an existing exception was present. Patch by Pablo Galindo.
bpo-44032 [https://bugs.python.org/issue?@action=redirect&bpo=44032]: Move 'fast' locals and other variables from the frame object to a per-thread datastack.
bpo-44114 [https://bugs.python.org/issue?@action=redirect&bpo=44114]: Fix incorrect dictkeys_reversed and dictitems_reversed function signatures in C code, which broke webassembly builds.
bpo-44110 [https://bugs.python.org/issue?@action=redirect&bpo=44110]: Improve
str.__getitem__()
error messagebpo-26110 [https://bugs.python.org/issue?@action=redirect&bpo=26110]: Add
CALL_METHOD_KW
opcode to speed up method calls with keyword arguments. Idea originated from PyPy. A side effect is executingCALL_METHOD
is now branchless in the evaluation loop.bpo-28307 [https://bugs.python.org/issue?@action=redirect&bpo=28307]: Compiler now optimizes simple C-style formatting with literal format containing only format codes %s, %r and %a by converting them to fstring expressions.
bpo-43149 [https://bugs.python.org/issue?@action=redirect&bpo=43149]: Correct the syntax error message regarding multiple exception types to not refer to "exception groups". Patch by Pablo Galindo
bpo-43822 [https://bugs.python.org/issue?@action=redirect&bpo=43822]: The parser will prioritize tokenizer errors over custom syntax errors when raising exceptions. Patch by Pablo Galindo.
bpo-40222 [https://bugs.python.org/issue?@action=redirect&bpo=40222]: "Zero cost" exception handling.
Uses a lookup table to determine how to handle exceptions.
Removes SETUP_FINALLY and POP_TOP block instructions, eliminating the runtime overhead of try statements.
Reduces the size of the frame object by about 60%.
Patch by Mark Shannon
bpo-43918 [https://bugs.python.org/issue?@action=redirect&bpo=43918]: Document the signature and
default
argument in the docstring of the newanext
builtin.bpo-43833 [https://bugs.python.org/issue?@action=redirect&bpo=43833]: Emit a deprecation warning if the numeric literal is immediately followed by one of keywords: and, else, for, if, in, is, or. Raise a syntax error with more informative message if it is immediately followed by other keyword or identifier.
bpo-43879 [https://bugs.python.org/issue?@action=redirect&bpo=43879]: Add native_thread_id to PyThreadState. Patch by Gabriele N. Tornetta.
bpo-43693 [https://bugs.python.org/issue?@action=redirect&bpo=43693]: Compute cell offsets relative to locals in compiler. Allows the interpreter to treats locals and cells a single array, which is slightly more efficient. Also make the LOAD_CLOSURE opcode an alias for LOAD_FAST. Preserving LOAD_CLOSURE helps keep bytecode a bit more readable.
bpo-17792 [https://bugs.python.org/issue?@action=redirect&bpo=17792]: More accurate error messages for access of unbound locals or free vars.
bpo-28146 [https://bugs.python.org/issue?@action=redirect&bpo=28146]: Fix a confusing error message in
str.format()
.bpo-11105 [https://bugs.python.org/issue?@action=redirect&bpo=11105]: When compiling
ast.AST
objects with recursive references throughcompile()
, the interpreter doesn't crash anymore instead it raises aRecursionError
.bpo-39091 [https://bugs.python.org/issue?@action=redirect&bpo=39091]: Fix crash when using passing a non-exception to a generator's
throw()
method. Patch by Noah Oxerbpo-33346 [https://bugs.python.org/issue?@action=redirect&bpo=33346]: Asynchronous comprehensions are now allowed inside comprehensions in asynchronous functions. Outer comprehensions implicitly become asynchronous.
库
bpo-45371 [https://bugs.python.org/issue?@action=redirect&bpo=45371]: Fix clang rpath issue in
distutils
. The UnixCCompiler now uses correct clang option to add a runtime library directory (rpath) to a shared library.bpo-45329 [https://bugs.python.org/issue?@action=redirect&bpo=45329]: Fix freed memory access in
pyexpat.xmlparser
when building it with an installed expat library <= 2.2.0.bpo-41710 [https://bugs.python.org/issue?@action=redirect&bpo=41710]: On Unix, if the
sem_clockwait()
function is available in the C library (glibc 2.30 and newer), thethreading.Lock.acquire()
method now uses the monotonic clock (time.CLOCK_MONOTONIC
) for the timeout, rather than using the system clock (time.CLOCK_REALTIME
), to not be affected by system clock changes. Patch by Victor Stinner.bpo-1596321 [https://bugs.python.org/issue?@action=redirect&bpo=1596321]: Fix the
threading._shutdown()
function when thethreading
module was imported first from a thread different than the main thread: no longer log an error at Python exit.bpo-45274 [https://bugs.python.org/issue?@action=redirect&bpo=45274]: Fix a race condition in the
Thread.join()
method of thethreading
module. If the function is interrupted by a signal and the signal handler raises an exception, make sure that the thread remains in a consistent state to prevent a deadlock. Patch by Victor Stinner.bpo-21302 [https://bugs.python.org/issue?@action=redirect&bpo=21302]: In Unix operating systems,
time.sleep()
now uses thenanosleep()
function, ifclock_nanosleep()
is not available butnanosleep()
is available.nanosleep()
allows to sleep with nanosecond precision.bpo-21302 [https://bugs.python.org/issue?@action=redirect&bpo=21302]: On Windows,
time.sleep()
now uses a waitable timer which has a resolution of 100 nanoseconds (10-7 seconds). Previously, it had a resolution of 1 millisecond (10-3 seconds). Patch by Benjamin Szőke and Victor Stinner.bpo-45238 [https://bugs.python.org/issue?@action=redirect&bpo=45238]: Fix
unittest.IsolatedAsyncioTestCase.debug()
: it runs now asynchronous methods and callbacks.bpo-36674 [https://bugs.python.org/issue?@action=redirect&bpo=36674]:
unittest.TestCase.debug()
raises now aunittest.SkipTest
if the class or the test method are decorated with the skipping decorator.bpo-45235 [https://bugs.python.org/issue?@action=redirect&bpo=45235]: Fix an issue where argparse would not preserve values in a provided namespace when using a subparser with defaults.
bpo-45183 [https://bugs.python.org/issue?@action=redirect&bpo=45183]: Have zipimport.zipimporter.find_spec() not raise an exception when the underlying zip file has been deleted and the internal cache has been reset via invalidate_cache().
bpo-45234 [https://bugs.python.org/issue?@action=redirect&bpo=45234]: Fixed a regression in
copyfile()
,copy()
,copy2()
raisingFileNotFoundError
when source is a directory, which should raiseIsADirectoryError
bpo-45228 [https://bugs.python.org/issue?@action=redirect&bpo=45228]: Fix stack buffer overflow in parsing J1939 network address.
bpo-45225 [https://bugs.python.org/issue?@action=redirect&bpo=45225]: use map function instead of genexpr in capwords.
bpo-42135 [https://bugs.python.org/issue?@action=redirect&bpo=42135]: Fix typo:
importlib.find_loader
is really slated for removal in Python 3.12 not 3.10, like the others in PR 25169.
Patch by Hugo van Kemenade.
bpo-20524 [https://bugs.python.org/issue?@action=redirect&bpo=20524]: Improves error messages on
.format()
operation forstr
,float
,int
, andcomplex
. New format now shows the problematic pattern and the object type.bpo-45168 [https://bugs.python.org/issue?@action=redirect&bpo=45168]: Change
dis.dis()
output to omit op arg values that cannot be resolved due toco_consts
,co_names
etc not being provided. Previously the oparg itself was repeated in the value field, which is not useful and can be confusing.bpo-21302 [https://bugs.python.org/issue?@action=redirect&bpo=21302]: In Unix operating systems,
time.sleep()
now uses theclock_nanosleep()
function, if available, which allows to sleep for an interval specified with nanosecond precision.bpo-45173 [https://bugs.python.org/issue?@action=redirect&bpo=45173]: Remove from the
configparser
module: theSafeConfigParser
class, thefilename
property of theParsingError
class, thereadfp()
method of theConfigParser
class, deprecated since Python 3.2.
Patch by Hugo van Kemenade.
bpo-44987 [https://bugs.python.org/issue?@action=redirect&bpo=44987]: Pure ASCII strings are now normalized in constant time by
unicodedata.normalize()
. Patch by Donghee Na.bpo-35474 [https://bugs.python.org/issue?@action=redirect&bpo=35474]: Calling
mimetypes.guess_all_extensions()
withstrict=False
no longer affects the result of the following call withstrict=True
. Also, mutating the returned list no longer affects the global state.bpo-45166 [https://bugs.python.org/issue?@action=redirect&bpo=45166]:
typing.get_type_hints()
now works withFinal
wrapped inForwardRef
.bpo-45162 [https://bugs.python.org/issue?@action=redirect&bpo=45162]: Remove many old deprecated
unittest
features:"
fail*
" and "assert*
" aliases ofTestCase
methods.Broken from start
TestCase
methodassertDictContainsSubset()
.Ignored
parameter useloadtests.TestLoader.loadTestsFromModule() Old alias
_TextTestResult
ofTextTestResult
.
bpo-38371 [https://bugs.python.org/issue?@action=redirect&bpo=38371]: Remove the deprecated
split()
method of_tkinter.TkappType
. Patch by Erlend E. Aasland.bpo-20499 [https://bugs.python.org/issue?@action=redirect&bpo=20499]: Improve the speed and accuracy of statistics.pvariance().
bpo-45132 [https://bugs.python.org/issue?@action=redirect&bpo=45132]: Remove
__getitem__()
methods ofxml.dom.pulldom.DOMEventStream
,wsgiref.util.FileWrapper
andfileinput.FileInput
, deprecated since Python 3.9.
Patch by Hugo van Kemenade.
- bpo-45129 [https://bugs.python.org/issue?@action=redirect&bpo=45129]: Due to significant security concerns, the reuse_address parameter of
asyncio.loop.create_datagram_endpoint()
, disabled in Python 3.9, is now entirely removed. This is because of the behavior of the socket optionSO_REUSEADDR
in UDP.
Patch by Hugo van Kemenade.
- bpo-45124 [https://bugs.python.org/issue?@action=redirect&bpo=45124]: The
bdist_msi
command, deprecated in Python 3.9, is now removed.
Use bdist_wheel
(wheel packages) instead.
Patch by Hugo van Kemenade.
bpo-30856 [https://bugs.python.org/issue?@action=redirect&bpo=30856]:
unittest.TestResult
methodsaddFailure()
,addError()
,addSkip()
andaddSubTest()
are now called immediately after raising an exception in test or finishing a subtest. Previously they were called only after finishing the test clean up.bpo-45034 [https://bugs.python.org/issue?@action=redirect&bpo=45034]: Changes how error is formatted for
struct.pack
with'H'
and'h'
modes and too large / small numbers. Now it shows the actual numeric limits, while previously it was showing arithmetic expressions.bpo-25894 [https://bugs.python.org/issue?@action=redirect&bpo=25894]:
unittest
now always reports skipped and failed subtests separately: separate characters in default mode and separate lines in verbose mode. Also the test description is now output for errors in test method, class and module cleanups.bpo-45081 [https://bugs.python.org/issue?@action=redirect&bpo=45081]: Fix issue when dataclasses that inherit from
typing.Protocol
subclasses have wrong__init__
. Patch provided by Yurii Karabas.bpo-45085 [https://bugs.python.org/issue?@action=redirect&bpo=45085]: The
binhex
module, deprecated in Python 3.9, is now removed. The followingbinascii
functions, deprecated in Python 3.9, are now also removed:a2b_hqx()
,b2a_hqx()
;rlecode_hqx()
,rledecode_hqx()
.
binascii.crc_hqx()
函数仍然可用。
Patch by Victor Stinner.
bpo-40360 [https://bugs.python.org/issue?@action=redirect&bpo=40360]: The
lib2to3
package is now deprecated and may not be able to parse Python 3.10 or newer. See the PEP 617 [https://peps.python.org/pep-0617/] (New PEG parser for CPython). Patch by Victor Stinner.bpo-45075 [https://bugs.python.org/issue?@action=redirect&bpo=45075]: Rename
traceback.StackSummary.format_frame()
totraceback.StackSummary.format_frame_summary()
. This method was added for 3.11 so it was not released yet.
Updated code and docs to better distinguish frame and FrameSummary.
bpo-31299 [https://bugs.python.org/issue?@action=redirect&bpo=31299]: Add option to completely drop frames from a traceback by returning
None
from aformat_frame()
override.bpo-41620 [https://bugs.python.org/issue?@action=redirect&bpo=41620]:
run()
now always return aTestResult
instance. Previously it returnedNone
if the test class or method was decorated with a skipping decorator.bpo-45021 [https://bugs.python.org/issue?@action=redirect&bpo=45021]: Fix a potential deadlock at shutdown of forked children when using
concurrent.futures
modulebpo-43913 [https://bugs.python.org/issue?@action=redirect&bpo=43913]: Fix bugs in cleaning up classes and modules in
unittest
:Functions registered with
addModuleCleanup()
were not called unless the user definestearDownModule()
in their test module.Functions registered with
addClassCleanup()
were not called iftearDownClass
is set toNone
.Buffering in
TestResult
did not work with functions registered withaddClassCleanup()
andaddModuleCleanup()
.Errors in functions registered with
addClassCleanup()
andaddModuleCleanup()
were not handled correctly in buffered and debug modes.Errors in
setUpModule()
and functions registered withaddModuleCleanup()
were reported in wrong order.And several lesser bugs.
bpo-45030 [https://bugs.python.org/issue?@action=redirect&bpo=45030]: Fix integer overflow in pickling and copying the range iterator.
bpo-45001 [https://bugs.python.org/issue?@action=redirect&bpo=45001]: Made email date parsing more robust against malformed input, namely a whitespace-only
Date:
header. Patch by Wouter Bolsterlee.bpo-45010 [https://bugs.python.org/issue?@action=redirect&bpo=45010]: Remove support of special method
__div__
inunittest.mock
. It is not used in Python 3.bpo-39218 [https://bugs.python.org/issue?@action=redirect&bpo=39218]: Improve accuracy of variance calculations by using
x*x
instead ofx**2
.bpo-43613 [https://bugs.python.org/issue?@action=redirect&bpo=43613]: Improve the speed of
gzip.compress()
andgzip.decompress()
by compressing and decompressing at once in memory instead of in a streamed fashion.bpo-37596 [https://bugs.python.org/issue?@action=redirect&bpo=37596]: Ensure that
set
andfrozenset
objects are alwaysmarshalled
reproducibly.bpo-44019 [https://bugs.python.org/issue?@action=redirect&bpo=44019]: A new function
operator.call
has been added, such thatoperator.call(obj, *args, **kwargs) == obj(*args, **kwargs)
.bpo-42255 [https://bugs.python.org/issue?@action=redirect&bpo=42255]:
webbrowser.MacOSX
is deprecated and will be removed in Python 3.13. It is untested and undocumented and also not used bywebbrowser
itself. Patch by Donghee Na.bpo-44955 [https://bugs.python.org/issue?@action=redirect&bpo=44955]: Method
stopTestRun()
is now always called in pair with methodstartTestRun()
forTestResult
objects implicitly created inrun()
. Previously it was not called for test methods and classes decorated with a skipping decorator.bpo-39039 [https://bugs.python.org/issue?@action=redirect&bpo=39039]: tarfile.open raises
ReadError
when a zlib error occurs during file extraction.bpo-44935 [https://bugs.python.org/issue?@action=redirect&bpo=44935]:
subprocess
on Solaris now also usesos.posix_spawn()
for better performance.bpo-44911 [https://bugs.python.org/issue?@action=redirect&bpo=44911]:
IsolatedAsyncioTestCase
will no longer throw an exception while cancelling leaked tasks. Patch by Bar Harel.bpo-41322 [https://bugs.python.org/issue?@action=redirect&bpo=41322]: Added
DeprecationWarning
for tests and async tests that return a value!=None (as this may indicate an improperly written test, for example a test written as a generator function).bpo-44524 [https://bugs.python.org/issue?@action=redirect&bpo=44524]: Make exception message more useful when subclass from typing special form alias. Patch provided by Yurii Karabas.
bpo-38956 [https://bugs.python.org/issue?@action=redirect&bpo=38956]:
argparse.BooleanOptionalAction
's default value is no longer printed twice when used withargparse.ArgumentDefaultsHelpFormatter
.bpo-44860 [https://bugs.python.org/issue?@action=redirect&bpo=44860]: Fix the
posix_user
scheme insysconfig
to not depend onsys.platlibdir
.bpo-44859 [https://bugs.python.org/issue?@action=redirect&bpo=44859]: Improve error handling in
sqlite3
and raise more accurate exceptions.MemoryError
is now raised instead ofsqlite3.Warning
when memory is not enough for encoding a statement to UTF-8 inConnection.__call__()
andCursor.execute()
.UnicodEncodeError
is now raised instead ofsqlite3.Warning
when the statement contains surrogate characters inConnection.__call__()
andCursor.execute()
.TypeError
is now raised instead ofValueError
for non-string script argument inCursor.executescript()
.ValueError
is now raised for script containing the null character instead of truncating it inCursor.executescript()
.Correctly handle exceptions raised when getting boolean value of the result of the progress handler.
Add many tests covering different corner cases.
bpo-44581 [https://bugs.python.org/issue?@action=redirect&bpo=44581]: Upgrade bundled pip to 21.2.3 and setuptools to 57.4.0
bpo-44849 [https://bugs.python.org/issue?@action=redirect&bpo=44849]: Fix the
os.set_inheritable()
function on FreeBSD 14 for file descriptor opened with theO_PATH
flag: ignore theEBADF
error onioctl()
, fallback on thefcntl()
implementation. Patch by Victor Stinner.bpo-44605 [https://bugs.python.org/issue?@action=redirect&bpo=44605]: The @functools.total_ordering() decorator now works with metaclasses.
bpo-44524 [https://bugs.python.org/issue?@action=redirect&bpo=44524]: Fixed an issue wherein the
__name__
and__qualname__
attributes of subscribed specialforms could beNone
.bpo-44839 [https://bugs.python.org/issue?@action=redirect&bpo=44839]:
MemoryError
raised in user-defined functions will now produce aMemoryError
insqlite3
.OverflowError
will now be converted toDataError
. PreviouslyOperationalError
was produced in these cases.bpo-44822 [https://bugs.python.org/issue?@action=redirect&bpo=44822]:
sqlite3
user-defined functions and aggregators returningstrings
with embedded NUL characters are no longer truncated. Patch by Erlend E. Aasland.bpo-44801 [https://bugs.python.org/issue?@action=redirect&bpo=44801]: Ensure that the
ParamSpec
variable in Callable can only be substituted with a parameters expression (a list of types, an ellipsis, ParamSpec or Concatenate).bpo-44806 [https://bugs.python.org/issue?@action=redirect&bpo=44806]: Non-protocol subclasses of
typing.Protocol
ignore now the__init__
method inherited from protocol base classes.bpo-27275 [https://bugs.python.org/issue?@action=redirect&bpo=27275]:
collections.OrderedDict.popitem()
andcollections.OrderedDict.pop()
no longer call__getitem__
and__delitem__
methods of the OrderedDict subclasses.bpo-44793 [https://bugs.python.org/issue?@action=redirect&bpo=44793]: Fix checking the number of arguments when subscribe a generic type with
ParamSpec
parameter.bpo-44784 [https://bugs.python.org/issue?@action=redirect&bpo=44784]: In importlib.metadata tests, override warnings behavior under expected DeprecationWarnings (importlib_metadata 4.6.3).
bpo-44667 [https://bugs.python.org/issue?@action=redirect&bpo=44667]: The
tokenize.tokenize()
doesn't incorrectly generate aNEWLINE
token if the source doesn't end with a new line character but the last line is a comment, as the function is already generating aNL
token. Patch by Pablo Galindobpo-44771 [https://bugs.python.org/issue?@action=redirect&bpo=44771]: Added
importlib.simple
module implementing adapters from a low-level resources reader interface to aTraversableResources
interface. Legacy API (path
,contents
, …) is now supported entirely by the.files()
API with a compatibility shim supplied for resource loaders without that functionality. Feature parity withimportlib_resources
5.2.bpo-44752 [https://bugs.python.org/issue?@action=redirect&bpo=44752]:
rcompleter
does not callgetattr()
onproperty
objects to avoid the side-effect of evaluating the corresponding method.bpo-44747 [https://bugs.python.org/issue?@action=redirect&bpo=44747]: Refactor usage of
sys._getframe
intyping
module. Patch provided by Yurii Karabas.bpo-42378 [https://bugs.python.org/issue?@action=redirect&bpo=42378]: Fixes the issue with log file being overwritten when
logging.FileHandler
is used inatexit
with filemode set to'w'
. Note this will cause the message in atexit not being logged if the log stream is already closed due to shutdown of logging.bpo-44720 [https://bugs.python.org/issue?@action=redirect&bpo=44720]:
weakref.proxy
objects referencing non-iterators now raiseTypeError
rather than dereferencing the nulltp_iternext
slot and crashing.bpo-44704 [https://bugs.python.org/issue?@action=redirect&bpo=44704]: The implementation of
collections.abc.Set._hash()
now matches that offrozenset.__hash__()
.bpo-44666 [https://bugs.python.org/issue?@action=redirect&bpo=44666]: Fixed issue in
compileall.compile_file()
whensys.stdout
is redirected. Patch by Stefan Hölzl.bpo-44688 [https://bugs.python.org/issue?@action=redirect&bpo=44688]:
sqlite3.Connection.create_collation()
now accepts nonASCII collation names. Patch by Erlend E. Aasland.bpo-44690 [https://bugs.python.org/issue?@action=redirect&bpo=44690]: Adopt binacii.a2b_base64's strict mode in base64.b64decode.
bpo-42854 [https://bugs.python.org/issue?@action=redirect&bpo=42854]: Fixed a bug in the
_ssl
module that was throwingOverflowError
when usingssl.SSLSocket.write()
andssl.SSLSocket.read()
for a big value of thelen
parameter. Patch by Pablo Galindo.bpo-44686 [https://bugs.python.org/issue?@action=redirect&bpo=44686]: Replace
unittest.mock._importer
withpkgutil.resolve_name
.bpo-44353 [https://bugs.python.org/issue?@action=redirect&bpo=44353]: Make
NewType.__call__
faster by implementing it in C. Patch provided by Yurii Karabas.bpo-44682 [https://bugs.python.org/issue?@action=redirect&bpo=44682]: Change the
pdb
commands directive to disallow setting commands for an invalid breakpoint and to display an appropriate error.bpo-44353 [https://bugs.python.org/issue?@action=redirect&bpo=44353]: Refactor
typing.NewType
from function into callable class. Patch provided by Yurii Karabas.bpo-44678 [https://bugs.python.org/issue?@action=redirect&bpo=44678]: Added a separate error message for discontinuous padding in binascii.a2b_base64 strict mode.
bpo-44524 [https://bugs.python.org/issue?@action=redirect&bpo=44524]: Add missing
__name__
and__qualname__
attributes totyping
module classes. Patch provided by Yurii Karabas.bpo-40897 [https://bugs.python.org/issue?@action=redirect&bpo=40897]: Give priority to using the current class constructor in
inspect.signature()
. Patch by Weipeng Hong.bpo-44638 [https://bugs.python.org/issue?@action=redirect&bpo=44638]: Add a reference to the zipp project and hint as to how to use it.
bpo-44648 [https://bugs.python.org/issue?@action=redirect&bpo=44648]: Fixed wrong error being thrown by
inspect.getsource()
when examining a class in the interactive session. Instead ofTypeError
, it should beOSError
with appropriate error message.bpo-44608 [https://bugs.python.org/issue?@action=redirect&bpo=44608]: Fix memory leak in
tkinter.flatten()
if it is called with a sequence or set, but not list or tuple.bpo-44594 [https://bugs.python.org/issue?@action=redirect&bpo=44594]: Fix an edge case of
ExitStack
andAsyncExitStack
exception chaining. They will now matchwith
block behavior when__context__
is explicitly set toNone
when the exception is in flight.bpo-42799 [https://bugs.python.org/issue?@action=redirect&bpo=42799]: In
fnmatch
, the cache size for compiled regex patterns (functools.lru_cache()
) was bumped up from 256 to 32768, affecting functions:fnmatch.fnmatch()
,fnmatch.fnmatchcase()
,fnmatch.filter()
.bpo-41928 [https://bugs.python.org/issue?@action=redirect&bpo=41928]: Update
shutil.copyfile()
to raiseFileNotFoundError
instead of confusingIsADirectoryError
when a path ending with aos.path.sep
does not exist;shutil.copy()
andshutil.copy2()
are also affected.bpo-44569 [https://bugs.python.org/issue?@action=redirect&bpo=44569]: Added the
StackSummary.format_frame()
function intraceback
. This allows users to customize the way individual lines are formatted in tracebacks without reimplementing logic to handle recursive tracebacks.bpo-44566 [https://bugs.python.org/issue?@action=redirect&bpo=44566]: handle StopIteration subclass raised from @contextlib.contextmanager generator
bpo-44558 [https://bugs.python.org/issue?@action=redirect&bpo=44558]: Make the implementation consistency of
indexOf()
between C and Python versions. Patch by Donghee Na.bpo-41249 [https://bugs.python.org/issue?@action=redirect&bpo=41249]: Fixes
TypedDict
to work withtyping.get_type_hints()
and postponed evaluation of annotations across modules.bpo-44554 [https://bugs.python.org/issue?@action=redirect&bpo=44554]: Refactor argument processing in
pdb.main()
to simplify detection of errors in input loading and clarify behavior around module or script invocation.bpo-34798 [https://bugs.python.org/issue?@action=redirect&bpo=34798]: Break up paragraph about
pprint.PrettyPrinter
construction parameters to make it easier to read.bpo-44539 [https://bugs.python.org/issue?@action=redirect&bpo=44539]: Added support for recognizing JPEG files without JFIF or Exif markers.
bpo-44461 [https://bugs.python.org/issue?@action=redirect&bpo=44461]: Fix bug with
pdb
's handling of import error due to a package which does not have a__main__
modulebpo-43625 [https://bugs.python.org/issue?@action=redirect&bpo=43625]: Fix a bug in the detection of CSV file headers by
csv.Sniffer.has_header()
and improve documentation of same.bpo-44516 [https://bugs.python.org/issue?@action=redirect&bpo=44516]: Update vendored pip to 21.1.3
bpo-42892 [https://bugs.python.org/issue?@action=redirect&bpo=42892]: Fixed an exception thrown while parsing a malformed multipart email by
email.message.EmailMessage
.bpo-44468 [https://bugs.python.org/issue?@action=redirect&bpo=44468]:
typing.get_type_hints()
now finds annotations in classes and base classes with unexpected__module__
. Previously, it skipped those MRO elements.bpo-44491 [https://bugs.python.org/issue?@action=redirect&bpo=44491]: Allow clearing the
sqlite3
authorizer callback by passingNone
toset_authorizer()
. Patch by Erlend E. Aasland.bpo-43977 [https://bugs.python.org/issue?@action=redirect&bpo=43977]: Set the proper
Py_TPFLAGS_MAPPING
andPy_TPFLAGS_SEQUENCE
flags for subclasses created before a parent has been registered as acollections.abc.Mapping
orcollections.abc.Sequence
.bpo-44482 [https://bugs.python.org/issue?@action=redirect&bpo=44482]: Fix very unlikely resource leak in
glob
in alternate Python implementations.bpo-44466 [https://bugs.python.org/issue?@action=redirect&bpo=44466]: The
faulthandler
module now detects if a fatal error occurs during a garbage collector collection. Patch by Victor Stinner.bpo-44471 [https://bugs.python.org/issue?@action=redirect&bpo=44471]: A
TypeError
is now raised instead of anAttributeError
incontextlib.ExitStack.enter_context()
andcontextlib.AsyncExitStack.enter_async_context()
for objects which do not support the context manager or asynchronous context manager protocols correspondingly.bpo-44404 [https://bugs.python.org/issue?@action=redirect&bpo=44404]:
tkinter
'safter()
method now supports callables without the__name__
attribute.bpo-41546 [https://bugs.python.org/issue?@action=redirect&bpo=41546]: Make
pprint
(like the builtinprint
) not attempt to write tostdout
when it isNone
.bpo-44458 [https://bugs.python.org/issue?@action=redirect&bpo=44458]:
BUFFER_BLOCK_SIZE
is now declared static, to avoid linking collisions when bz2, lmza or zlib are statically linked.bpo-44464 [https://bugs.python.org/issue?@action=redirect&bpo=44464]: Remove exception for flake8 in deprecated importlib.metadata interfaces. Sync with importlib_metadata 4.6.
bpo-44446 [https://bugs.python.org/issue?@action=redirect&bpo=44446]: Take into account that
lineno
might beNone
intraceback.FrameSummary
.bpo-44439 [https://bugs.python.org/issue?@action=redirect&bpo=44439]: Fix in
bz2.BZ2File.write()
/lzma.LZMAFile.write()
methods, when the input data is an object that supports the buffer protocol, the file length may be wrong.bpo-44434 [https://bugs.python.org/issue?@action=redirect&bpo=44434]: thread.startnew_thread() no longer calls PyThread_exit_thread() explicitly at the thread exit, the call was redundant. On Linux with the glibc, pthread_exit() aborts the whole process if dlopen() fails to open libgcc_s.so file (ex: EMFILE error). Patch by Victor Stinner.
bpo-42972 [https://bugs.python.org/issue?@action=redirect&bpo=42972]: The _thread.RLock type now fully implement the GC protocol: add a traverse function and the
Py_TPFLAGS_HAVE_GC
flag. Patch by Victor Stinner.bpo-44422 [https://bugs.python.org/issue?@action=redirect&bpo=44422]: The
threading.enumerate()
function now uses a reentrant lock to prevent a hang on reentrant call. Patch by Victor Stinner.bpo-38291 [https://bugs.python.org/issue?@action=redirect&bpo=38291]: Importing typing.io or typing.re now prints a
DeprecationWarning
.bpo-37880 [https://bugs.python.org/issue?@action=redirect&bpo=37880]: argparse actions store_const and append_const each receive a default value of
None
when theconst
kwarg is not provided. Previously, this raised aTypeError
.bpo-44389 [https://bugs.python.org/issue?@action=redirect&bpo=44389]: Fix deprecation of
ssl.OP_NO_TLSv1_3
bpo-27827 [https://bugs.python.org/issue?@action=redirect&bpo=27827]:
pathlib.PureWindowsPath.is_reserved()
now identifies a greater range of reserved filenames, including those with trailing spaces or colons.bpo-44395 [https://bugs.python.org/issue?@action=redirect&bpo=44395]: Fix
as_string()
to pass unixfrom properly. Patch by Donghee Na.bpo-34266 [https://bugs.python.org/issue?@action=redirect&bpo=34266]: Handle exceptions from parsing the arg of
pdb
's run/restart command.bpo-44362 [https://bugs.python.org/issue?@action=redirect&bpo=44362]: Improve
ssl
module's deprecation messages, error reporting, and documentation for deprecations.bpo-44342 [https://bugs.python.org/issue?@action=redirect&bpo=44342]: [Enum] Change pickling from by-value to by-name.
bpo-44356 [https://bugs.python.org/issue?@action=redirect&bpo=44356]: [Enum] Allow multiple datatype mixins if they are all the same.
bpo-44351 [https://bugs.python.org/issue?@action=redirect&bpo=44351]: Restore back
parse_makefile()
indistutils.sysconfig
because it behaves differently than the similar implementation insysconfig
.bpo-35800 [https://bugs.python.org/issue?@action=redirect&bpo=35800]:
smtpd.MailmanProxy
is now removed as it is unusable without an external module,mailman
. Patch by Donghee Na.bpo-44357 [https://bugs.python.org/issue?@action=redirect&bpo=44357]: Added a function that returns cube root of the given number
math.cbrt()
bpo-44339 [https://bugs.python.org/issue?@action=redirect&bpo=44339]: Change
math.pow(±0.0, -math.inf)
to returninf
instead of raisingValueError
. This brings the special-case handling ofmath.pow
into compliance with the IEEE 754 standard.bpo-44242 [https://bugs.python.org/issue?@action=redirect&bpo=44242]: Remove missing flag check from Enum creation and move into a
verify
decorator.bpo-44246 [https://bugs.python.org/issue?@action=redirect&bpo=44246]: In
importlib.metadata
, restore compatibility in the result fromDistribution.entry_points
(EntryPoints
) to honor expectations in older implementations and issuing deprecation warnings for these cases: A.EntryPoints
objects are once again mutable, allowing forsort()
and other list-based mutation operations. Avoid deprecation warnings by casting to a mutable sequence (e.g.list(dist.entry_points).sort()
). B.EntryPoints
results once again allow for access by index. To avoid deprecation warnings, cast the result to a Sequence first (e.g.tuple(dist.entry_points)[0]
).bpo-44246 [https://bugs.python.org/issue?@action=redirect&bpo=44246]: In importlib.metadata.entry_points, deduplication of distributions no longer requires loading the full metadata for PathDistribution objects, improving entry point loading performance by ~10x.
bpo-43858 [https://bugs.python.org/issue?@action=redirect&bpo=43858]: Added a function that returns a copy of a dict of logging levels:
logging.getLevelNamesMapping()
bpo-44260 [https://bugs.python.org/issue?@action=redirect&bpo=44260]: The
random.Random
constructor no longer reads system entropy without need.bpo-44254 [https://bugs.python.org/issue?@action=redirect&bpo=44254]: On Mac, give turtledemo button text a color that works on both light or dark background. Programmers cannot control the latter.
bpo-44258 [https://bugs.python.org/issue?@action=redirect&bpo=44258]: Support PEP 515 for Fraction's initialization from string.
bpo-44235 [https://bugs.python.org/issue?@action=redirect&bpo=44235]: Remove deprecated functions in the
gettext
. Patch by Donghee Na.bpo-38693 [https://bugs.python.org/issue?@action=redirect&bpo=38693]: Prefer fstrings to
.format
in importlib.resources.bpo-33693 [https://bugs.python.org/issue?@action=redirect&bpo=33693]: Importlib.metadata now prefers fstrings to .format.
bpo-44241 [https://bugs.python.org/issue?@action=redirect&bpo=44241]: Incorporate minor tweaks from importlib_metadata 4.1: SimplePath protocol, support for Metadata 2.2.
bpo-43216 [https://bugs.python.org/issue?@action=redirect&bpo=43216]: Remove the
@asyncio.coroutine
decorator enabling legacy generator-based coroutines to be compatible with async/await code; removeasyncio.coroutines.CoroWrapper
used for wrapping legacy coroutine objects in the debug mode. The decorator has been deprecated since Python 3.8 and the removal was initially scheduled for Python 3.10. Patch by Illia Volochii.bpo-44210 [https://bugs.python.org/issue?@action=redirect&bpo=44210]: Make importlib.metadata._meta.PackageMetadata public.
bpo-43643 [https://bugs.python.org/issue?@action=redirect&bpo=43643]: Declare readers.MultiplexedPath.name as a property per the spec.
bpo-27334 [https://bugs.python.org/issue?@action=redirect&bpo=27334]: The
sqlite3
context manager now performs a rollback (thus releasing the database lock) if commit failed. Patch by Luca Citi and Erlend E. Aasland.bpo-4928 [https://bugs.python.org/issue?@action=redirect&bpo=4928]: Documented existing behavior on POSIX: NamedTemporaryFiles are not deleted when creating process is killed with SIGKILL
bpo-44154 [https://bugs.python.org/issue?@action=redirect&bpo=44154]: Optimize
fractions.Fraction
pickling for large components.bpo-33433 [https://bugs.python.org/issue?@action=redirect&bpo=33433]: For IPv4 mapped IPv6 addresses ( RFC 4291 [https://datatracker.ietf.org/doc/html/rfc4291.html] Section 2.5.5.2), the
ipaddress.IPv6Address.is_private
check is deferred to the mapped IPv4 address. This solves a bug where public mapped IPv4 addresses were considered private by the IPv6 check.bpo-44150 [https://bugs.python.org/issue?@action=redirect&bpo=44150]: Add optional weights argument to statistics.fmean().
bpo-44142 [https://bugs.python.org/issue?@action=redirect&bpo=44142]:
ast.unparse()
will now drop the redundant parentheses when tuples used as assignment targets (e.g in for loops).bpo-44145 [https://bugs.python.org/issue?@action=redirect&bpo=44145]:
hmac
computations were not releasing the GIL while calling the OpenSSLHMAC_Update
C API (a new feature in 3.9). This unintentionally prevented parallel computation as otherhashlib
algorithms support.bpo-44095 [https://bugs.python.org/issue?@action=redirect&bpo=44095]:
zipfile.Path
now supportszipfile.Path.stem
,zipfile.Path.suffixes
, andzipfile.Path.suffix
attributes.bpo-44077 [https://bugs.python.org/issue?@action=redirect&bpo=44077]: It's now possible to receive the type of service (ToS), a.k.a. differentiated services (DS), a.k.a. differentiated services code point (DSCP) and explicit congestion notification (ECN) IP header fields with
socket.IP_RECVTOS
.bpo-37788 [https://bugs.python.org/issue?@action=redirect&bpo=37788]: Fix a reference leak when a Thread object is never joined.
bpo-38908 [https://bugs.python.org/issue?@action=redirect&bpo=38908]: Subclasses of
typing.Protocol
which only have data variables declared will now raise aTypeError
when checked withisinstance
unless they are decorated withruntime_checkable()
. Previously, these checks passed silently. Patch provided by Yurii Karabas.bpo-44098 [https://bugs.python.org/issue?@action=redirect&bpo=44098]:
typing.ParamSpec
will no longer be found in the__parameters__
of mosttyping
generics except in valid use locations specified by PEP 612 [https://peps.python.org/pep-0612/]. This prevents incorrect usage liketyping.List[P][int]
. This change means incorrect usage which may have passed silently in 3.10 beta 1 and earlier will now error.bpo-44089 [https://bugs.python.org/issue?@action=redirect&bpo=44089]: Allow subclassing
csv.Error
in 3.10 (it was allowed in 3.9 and earlier but was disallowed in early versions of 3.10).bpo-44081 [https://bugs.python.org/issue?@action=redirect&bpo=44081]:
ast.unparse()
now doesn't use redundant spaces to separatelambda
and the:
if there are no parameters.bpo-44061 [https://bugs.python.org/issue?@action=redirect&bpo=44061]: Fix regression in previous release when calling
pkgutil.iter_modules()
with a list ofpathlib.Path
objectsbpo-44059 [https://bugs.python.org/issue?@action=redirect&bpo=44059]: Register the SerenityOS Browser in the
webbrowser
module.bpo-36515 [https://bugs.python.org/issue?@action=redirect&bpo=36515]: The
hashlib
module no longer does unaligned memory accesses when compiled for ARM platforms.bpo-40465 [https://bugs.python.org/issue?@action=redirect&bpo=40465]: Remove random module features deprecated in Python 3.9.
bpo-44018 [https://bugs.python.org/issue?@action=redirect&bpo=44018]: random.seed() no longer mutates bytearray inputs.
bpo-38352 [https://bugs.python.org/issue?@action=redirect&bpo=38352]: Add
IO
,BinaryIO
,TextIO
,Match
, andPattern
totyping.__all__
. Patch by Jelle Zijlstra.bpo-44002 [https://bugs.python.org/issue?@action=redirect&bpo=44002]:
urllib.parse
now usesfunctool.lru_cache()
for its internal URL splitting and quoting caches instead of rolling its own like its the '90s.
The undocumented internal urllib.parse
Quoted
class API is now deprecated, for removal in 3.14.
bpo-43972 [https://bugs.python.org/issue?@action=redirect&bpo=43972]: When
http.server.SimpleHTTPRequestHandler
sends a301 (Moved Permanently)
for a directory path not ending with/
, add aContent-Length: 0
header. This improves the behavior for certain clients.bpo-28528 [https://bugs.python.org/issue?@action=redirect&bpo=28528]: Fix a bug in
pdb
wherecheckline()
raisesAttributeError
if it is called afterreset()
.bpo-43853 [https://bugs.python.org/issue?@action=redirect&bpo=43853]: Improved string handling for
sqlite3
user-defined functions and aggregates:It is now possible to pass strings with embedded null characters to UDFs
Conversion failures now correctly raise
MemoryError
Patch by Erlend E. Aasland.
bpo-43666 [https://bugs.python.org/issue?@action=redirect&bpo=43666]: AIX:
Lib/aixsupport.get_platform()
may fail in an AIX WPAR. The fileset bos.rte appears to have a builddate in both LPAR and WPAR so this fileset is queried rather than bos.mp64. To prevent a similar situation (no builddate in ODM) a value (9988) sufficient for completing a build is provided. Patch by M Felt.bpo-43650 [https://bugs.python.org/issue?@action=redirect&bpo=43650]: Fix
MemoryError
inshutil.unpack_archive()
which fails insideshutil._unpack_zipfile()
on large files. Patch by Igor Bolshakov.bpo-43612 [https://bugs.python.org/issue?@action=redirect&bpo=43612]:
zlib.compress()
now accepts a wbits parameter which allows users to compress data as a raw deflate block without zlib headers and trailers in one go. Previously this required instantiating azlib.compressobj
. It also provides a faster alternative togzip.compress
when wbits=31 is used.bpo-43392 [https://bugs.python.org/issue?@action=redirect&bpo=43392]:
importlib._bootstrap._find_and_load()
now implements a two-step check to avoid locking when modules have been already imported and are ready. This improves performance of repeated calls toimportlib.import_module()
andimportlib.__import__()
.bpo-43318 [https://bugs.python.org/issue?@action=redirect&bpo=43318]: Fix a bug where
pdb
does not always echo cleared breakpoints.bpo-43234 [https://bugs.python.org/issue?@action=redirect&bpo=43234]: Prohibit passing non-
concurrent.futures.ThreadPoolExecutor
executors toloop.set_default_executor()
following a deprecation in Python 3.8. Patch by Illia Volochii.bpo-43232 [https://bugs.python.org/issue?@action=redirect&bpo=43232]: Prohibit previously deprecated potentially disruptive operations on
asyncio.trsock.TransportSocket
. Patch by Illia Volochii.bpo-30077 [https://bugs.python.org/issue?@action=redirect&bpo=30077]: Added support for Apple's aifc/sowt pseudo-compression
bpo-42971 [https://bugs.python.org/issue?@action=redirect&bpo=42971]: Add definition of
errno.EQFULL
for platforms that define this constant (such as macOS).bpo-43086 [https://bugs.python.org/issue?@action=redirect&bpo=43086]: Added a new optional
strict_mode
parameter to binascii.a2b_base64. Whenscrict_mode
is set toTrue
, the a2b_base64 function will accept only valid base64 content. More details about what "valid base64 content" is, can be found in the function's documentation.bpo-43024 [https://bugs.python.org/issue?@action=redirect&bpo=43024]: Improve the help signature of
traceback.print_exception()
,traceback.format_exception()
andtraceback.format_exception_only()
.bpo-33809 [https://bugs.python.org/issue?@action=redirect&bpo=33809]: Add the
traceback.TracebackException.print()
method which prints the formatted exception information.bpo-42862 [https://bugs.python.org/issue?@action=redirect&bpo=42862]:
sqlite3
now utilizesfunctools.lru_cache()
to implement the connection statement cache. As a small optimisation, the default statement cache size has been increased from 100 to 128. Patch by Erlend E. Aasland.bpo-41818 [https://bugs.python.org/issue?@action=redirect&bpo=41818]: Soumendra Ganguly: add termios.tcgetwinsize(), termios.tcsetwinsize().
bpo-40497 [https://bugs.python.org/issue?@action=redirect&bpo=40497]:
subprocess.check_output()
now raisesValueError
when the invalid keyword argument check is passed by user code. Previously such use would fail later with aTypeError
. Patch by Rémi Lapeyre.bpo-37449 [https://bugs.python.org/issue?@action=redirect&bpo=37449]:
ensurepip
now usesimportlib.resources.files()
traversable APIsbpo-40956 [https://bugs.python.org/issue?@action=redirect&bpo=40956]: Use Argument Clinic in
sqlite3
. Patches by Erlend E. Aasland.bpo-41730 [https://bugs.python.org/issue?@action=redirect&bpo=41730]:
DeprecationWarning
is now raised when importingtkinter.tix
, which has been deprecated in documentation since Python 3.6.bpo-20684 [https://bugs.python.org/issue?@action=redirect&bpo=20684]: Remove unused
_signaturegetbound_param
function frominspect
- by Anthony Sottile.bpo-41402 [https://bugs.python.org/issue?@action=redirect&bpo=41402]: Fix
email.message.EmailMessage.set_content()
when called with binary data and7bit
content transfer encoding.bpo-32695 [https://bugs.python.org/issue?@action=redirect&bpo=32695]: The compresslevel and preset keyword arguments of
tarfile.open()
are now both documented and tested.bpo-41137 [https://bugs.python.org/issue?@action=redirect&bpo=41137]: Use utf-8 encoding while reading .pdbrc files. Patch by Srinivas Reddy Thatiparthy
bpo-24391 [https://bugs.python.org/issue?@action=redirect&bpo=24391]: Improved reprs of
threading
synchronization objects:Semaphore
,BoundedSemaphore
,Event
andBarrier
.bpo-5846 [https://bugs.python.org/issue?@action=redirect&bpo=5846]: Deprecated the following
unittest
functions, scheduled for removal in Python 3.13:findTestCases()
makeSuite()
getTestCaseNames()
请改用 TestLoader
方法:
Patch by Erlend E. Aasland.
bpo-40563 [https://bugs.python.org/issue?@action=redirect&bpo=40563]: Support pathlike objects on dbm/shelve. Patch by Hakan Çelik and Henry-Joseph Audéoud.
bpo-34990 [https://bugs.python.org/issue?@action=redirect&bpo=34990]: Fixed a Y2k38 bug in the compileall module where it would fail to compile files with a modification time after the year 2038.
bpo-39549 [https://bugs.python.org/issue?@action=redirect&bpo=39549]: Whereas the code for reprlib.Repr had previously used a hardcoded string value of '…', this PR updates it to use of a “fillvalue” attribute, whose value defaults to '…' and can be reset in either individual reprlib.Repr instances or in subclasses thereof.
bpo-37022 [https://bugs.python.org/issue?@action=redirect&bpo=37022]:
pdb
now displays exceptions fromrepr()
with itsp
andpp
commands.bpo-38840 [https://bugs.python.org/issue?@action=redirect&bpo=38840]: Fix
test___all__
on platforms lacking a shared memory implementation.bpo-39359 [https://bugs.python.org/issue?@action=redirect&bpo=39359]: Add one missing check that the password is a bytes object for an encrypted zipfile.
bpo-38741 [https://bugs.python.org/issue?@action=redirect&bpo=38741]:
configparser
: using ']' inside a section header will no longer cut the section name short at the ']'bpo-38415 [https://bugs.python.org/issue?@action=redirect&bpo=38415]: Added missing behavior to
contextlib.asynccontextmanager()
to matchcontextlib.contextmanager()
so decorated functions can themselves be decorators.bpo-30256 [https://bugs.python.org/issue?@action=redirect&bpo=30256]: Pass multiprocessing BaseProxy argument
manager_owned
through AutoProxy.bpo-27513 [https://bugs.python.org/issue?@action=redirect&bpo=27513]:
email.utils.getaddresses()
now acceptsemail.header.Header
objects along with string values. Patch by Zackery Spytz.bpo-16379 [https://bugs.python.org/issue?@action=redirect&bpo=16379]: Add SQLite error code and name to
sqlite3
exceptions. Patch by Aviv Palivoda, Daniel Shahaf, and Erlend E. Aasland.bpo-26228 [https://bugs.python.org/issue?@action=redirect&bpo=26228]: pty.spawn no longer hangs on FreeBSD, macOS, and Solaris.
bpo-33349 [https://bugs.python.org/issue?@action=redirect&bpo=33349]: lib2to3 now recognizes async generators everywhere.
bpo-29298 [https://bugs.python.org/issue?@action=redirect&bpo=29298]: Fix
TypeError
when required subparsers withoutdest
do not receive arguments. Patch by Anthony Sottile.
文档
bpo-45216 [https://bugs.python.org/issue?@action=redirect&bpo=45216]: Remove extra documentation listing methods in
difflib
. It was rendering twice in pydoc and was outdated in some places.bpo-45024 [https://bugs.python.org/issue?@action=redirect&bpo=45024]:
collections.abc
documentation has been expanded to explicitly cover how instance and subclass checks work, with additional doctest examples and an exhaustive list of ABCs which test membership purely by presence of the right special methods. Patch by Raymond Hettinger.bpo-44957 [https://bugs.python.org/issue?@action=redirect&bpo=44957]: Promote PEP 604 union syntax by using it where possible. Also, mention
X | Y
more prominently in section aboutUnion
and mentionX | None
at all in section aboutOptional
.bpo-16580 [https://bugs.python.org/issue?@action=redirect&bpo=16580]: Added code equivalents for the
int.to_bytes()
andint.from_bytes()
methods, as well as tests ensuring that these code equivalents are valid.bpo-44903 [https://bugs.python.org/issue?@action=redirect&bpo=44903]: Removed the
othergui.rst
file, any references to it, and the list of GUI frameworks in the FAQ. In their place I've added links to the Python Wiki page on GUI frameworks [https://wiki.python.org/moin/GuiProgramming].bpo-33479 [https://bugs.python.org/issue?@action=redirect&bpo=33479]: Tkinter documentation has been greatly expanded with new "Architecture" and "Threading model" sections.
bpo-36700 [https://bugs.python.org/issue?@action=redirect&bpo=36700]:
base64
RFC references were updated to point to RFC 4648 [https://datatracker.ietf.org/doc/html/rfc4648.html]; a section was added to point users to the new "security considerations" section of the RFC.bpo-44740 [https://bugs.python.org/issue?@action=redirect&bpo=44740]: Replaced occurrences of uppercase "Web" and "Internet" with lowercase versions per the 2016 revised Associated Press Style Book.
bpo-44693 [https://bugs.python.org/issue?@action=redirect&bpo=44693]: Update the definition of future in the glossary by replacing the confusing word "pseudo-module" with a more accurate description.
bpo-35183 [https://bugs.python.org/issue?@action=redirect&bpo=35183]: Add typical examples to os.path.splitext docs
bpo-30511 [https://bugs.python.org/issue?@action=redirect&bpo=30511]: Clarify that
shutil.make_archive()
is not threadsafe due to reliance on changing the current working directory.bpo-44561 [https://bugs.python.org/issue?@action=redirect&bpo=44561]: Update of three expired hyperlinks in Doc/distributing/index.rst: "Project structure", "Building and packaging the project", and "Uploading the project to the Python Packaging Index".
bpo-44651 [https://bugs.python.org/issue?@action=redirect&bpo=44651]: Delete entry "coercion" in Doc/glossary.rst for its outdated definition.
bpo-42958 [https://bugs.python.org/issue?@action=redirect&bpo=42958]: Updated the docstring and docs of
filecmp.cmp()
to be more accurate and less confusing especially in respect to shallow arg.bpo-44631 [https://bugs.python.org/issue?@action=redirect&bpo=44631]: Refactored the
repr()
code of the_Environ
(os module).bpo-44613 [https://bugs.python.org/issue?@action=redirect&bpo=44613]: importlib.metadata is no longer provisional.
bpo-44558 [https://bugs.python.org/issue?@action=redirect&bpo=44558]: Match the docstring and python implementation of
countOf()
to the behavior of its c implementation.bpo-44544 [https://bugs.python.org/issue?@action=redirect&bpo=44544]: List all kwargs for
textwrap.wrap()
,textwrap.fill()
, andtextwrap.shorten()
. Now, there are nav links to attributes ofTextWrap
, which makes navigation much easier while minimizing duplication in the documentation.bpo-38062 [https://bugs.python.org/issue?@action=redirect&bpo=38062]: Clarify that atexit uses equality comparisons internally.
bpo-40620 [https://bugs.python.org/issue?@action=redirect&bpo=40620]: Convert examples in tutorial controlflow.rst section 4.3 to be interpreter-demo style.
bpo-43066 [https://bugs.python.org/issue?@action=redirect&bpo=43066]: Added a warning to
zipfile
docs: filename arg with a leading slash may cause archive to be un-openable on Windows systems.bpo-39452 [https://bugs.python.org/issue?@action=redirect&bpo=39452]: Rewrote
Doc/library/__main__.rst
. Broadened scope of the document to explicitly discuss and differentiate between__main__.py
in packages versus the__name__ == '__main__'
expression (and the idioms that surround it).bpo-13814 [https://bugs.python.org/issue?@action=redirect&bpo=13814]: In the Design FAQ, answer "Why don't generators support the with statement?"
bpo-27752 [https://bugs.python.org/issue?@action=redirect&bpo=27752]: Documentation of csv.Dialect is more descriptive.
bpo-44453 [https://bugs.python.org/issue?@action=redirect&bpo=44453]: Fix documentation for the return type of
sysconfig.get_path()
.bpo-44392 [https://bugs.python.org/issue?@action=redirect&bpo=44392]: Added a new section in the C API documentation for types used in type hinting. Documented
Py_GenericAlias
andPy_GenericAliasType
.bpo-38291 [https://bugs.python.org/issue?@action=redirect&bpo=38291]: Mark
typing.io
andtyping.re
as deprecated since Python 3.8 in the documentation. They were never properly supported by type checkers.bpo-44322 [https://bugs.python.org/issue?@action=redirect&bpo=44322]: Document that SyntaxError args have a details tuple and that details are adjusted for errors in fstring field replacement expressions.
bpo-42392 [https://bugs.python.org/issue?@action=redirect&bpo=42392]: Document the deprecation and removal of the
loop
parameter for many functions and classes inasyncio
.bpo-44195 [https://bugs.python.org/issue?@action=redirect&bpo=44195]: Corrected references to
TraversableResources
in docs. There is noTraversableReader
.bpo-41963 [https://bugs.python.org/issue?@action=redirect&bpo=41963]: Document that
ConfigParser
strips off comments when reading configuration files.bpo-44072 [https://bugs.python.org/issue?@action=redirect&bpo=44072]: Correct where in the numeric ABC hierarchy
**
support is added, i.e., in numbers.Complex, not numbers.Integral.bpo-43558 [https://bugs.python.org/issue?@action=redirect&bpo=43558]: Add the remark to
dataclasses
documentation that the__init__()
of any base class has to be called in__post_init__()
, along with a code example.bpo-44025 [https://bugs.python.org/issue?@action=redirect&bpo=44025]: Clarify when '_' in match statements is a keyword, and when not.
bpo-41706 [https://bugs.python.org/issue?@action=redirect&bpo=41706]: Fix docs about how methods like
__add__
are invoked when evaluating operator expressions.bpo-41621 [https://bugs.python.org/issue?@action=redirect&bpo=41621]: Document that
collections.defaultdict
parameterdefault_factory
defaults toNone
and is positional-only.bpo-41576 [https://bugs.python.org/issue?@action=redirect&bpo=41576]: document BaseException in favor of bare except
bpo-21760 [https://bugs.python.org/issue?@action=redirect&bpo=21760]: The description for file fixed. Patch by Furkan Onder
bpo-39498 [https://bugs.python.org/issue?@action=redirect&bpo=39498]: Add a "Security Considerations" index which links to standard library modules that have explicitly documented security considerations.
bpo-33479 [https://bugs.python.org/issue?@action=redirect&bpo=33479]: Remove the unqualified claim that tkinter is threadsafe. It has not been true for several years and likely never was. An explanation of what is true may be added later, after more discussion, and possibly after patching _tkinter.c,
测试
bpo-40173 [https://bugs.python.org/issue?@action=redirect&bpo=40173]: Fix
test.support.import_helper.import_fresh_module()
.bpo-45280 [https://bugs.python.org/issue?@action=redirect&bpo=45280]: Add a test case for empty
typing.NamedTuple
.bpo-45269 [https://bugs.python.org/issue?@action=redirect&bpo=45269]: Cover case when invalid
markers
type is supplied toc_make_encoder
.bpo-45128 [https://bugs.python.org/issue?@action=redirect&bpo=45128]: Fix
test_multiprocessing_fork
failure due totest_logging
andsys.modules
manipulation.bpo-45209 [https://bugs.python.org/issue?@action=redirect&bpo=45209]: Fix
UserWarning: resource_tracker
warning intestmultiprocessing._TestSharedMemory.test_shared_memory_cleaned_after_process_termination
bpo-45185 [https://bugs.python.org/issue?@action=redirect&bpo=45185]: Enables
TestEnumerations
test cases intest_ssl
suite.bpo-45195 [https://bugs.python.org/issue?@action=redirect&bpo=45195]: Fix test_readline.test_nonascii(): sometimes, the newline character is not written at the end, so don't expect it in the output. Patch by Victor Stinner.
bpo-45156 [https://bugs.python.org/issue?@action=redirect&bpo=45156]: Fixes infinite loop on
unittest.mock.seal()
of mocks created bycreate_autospec()
.bpo-45125 [https://bugs.python.org/issue?@action=redirect&bpo=45125]: Improves pickling tests and docs of
SharedMemory
andSharableList
objects.bpo-44860 [https://bugs.python.org/issue?@action=redirect&bpo=44860]: Update
test_sysconfig.test_user_similar()
for the posix_user scheme:platlib
doesn't usesys.platlibdir
. Patch by Victor Stinner.bpo-45052 [https://bugs.python.org/issue?@action=redirect&bpo=45052]:
WithProcessesTestSharedMemory.test_shared_memory_basics
test was ignored, becauseself.assertEqual(sms.size, sms2.size)
line was failing. It is now removed and test is unskipped.
The main motivation for this line to be removed from the test is that the size
of SharedMemory
is not ever guaranteed to be the same. It is decided by the platform.
bpo-44895 [https://bugs.python.org/issue?@action=redirect&bpo=44895]: libregrtest now clears the type cache later to reduce the risk of false alarm when checking for reference leaks. Previously, the type cache was cleared too early and libregrtest raised a false alarm about reference leaks under very specific conditions. Patch by Irit Katriel and Victor Stinner.
bpo-45042 [https://bugs.python.org/issue?@action=redirect&bpo=45042]: Fixes that test classes decorated with
@hashlib_helper.requires_hashdigest
were skipped all the time.bpo-25130 [https://bugs.python.org/issue?@action=redirect&bpo=25130]: Add calls of
gc.collect()
in tests to support PyPy.bpo-45011 [https://bugs.python.org/issue?@action=redirect&bpo=45011]: Made tests relying on the
_asyncio
C extension module optional to allow running on alternative Python implementations. Patch by Serhiy Storchaka.bpo-44949 [https://bugs.python.org/issue?@action=redirect&bpo=44949]: Fix auto history tests of test_readline: sometimes, the newline character is not written at the end, so don't expect it in the output.
bpo-44891 [https://bugs.python.org/issue?@action=redirect&bpo=44891]: Tests were added to clarify
id()
is preserved whenobj * 1
is used onstr
andbytes
objects. Patch by Nikita Sobolev.bpo-44852 [https://bugs.python.org/issue?@action=redirect&bpo=44852]: Add ability to wholesale silence DeprecationWarnings while running the regression test suite.
bpo-40928 [https://bugs.python.org/issue?@action=redirect&bpo=40928]: Notify users running test_decimal regression tests on macOS of potential harmless "malloc can't allocate region" messages spewed by test_decimal.
bpo-44734 [https://bugs.python.org/issue?@action=redirect&bpo=44734]: Fixed floating-point precision issue in turtle tests.
bpo-44708 [https://bugs.python.org/issue?@action=redirect&bpo=44708]: Regression tests, when run with -w, are now re-running only the affected test methods instead of re-running the entire test file.
bpo-42095 [https://bugs.python.org/issue?@action=redirect&bpo=42095]: Added interop tests for Apple plists: generate plist files with Python plistlib and parse with Apple plutil; and the other way round.
bpo-44647 [https://bugs.python.org/issue?@action=redirect&bpo=44647]: Added a permanent Unicode-valued environment variable to regression tests to ensure they handle this use case in the future. If your test environment breaks because of that, report a bug to us, and temporarily set PYTHONREGRTEST_UNICODE_GUARD=0 in your test environment.
bpo-44515 [https://bugs.python.org/issue?@action=redirect&bpo=44515]: Adjust recently added contextlib tests to avoid assuming the use of a refcounted GC
bpo-44287 [https://bugs.python.org/issue?@action=redirect&bpo=44287]: Fix asyncio test_popen() of test_windows_utils by using a longer timeout. Use military grade battle-tested
test.support.SHORT_TIMEOUT
timeout rather than a hardcoded timeout of 10 seconds: it's 30 seconds by default, but it is made longer on slow buildbots. Patch by Victor Stinner.bpo-44451 [https://bugs.python.org/issue?@action=redirect&bpo=44451]: Reset
DeprecationWarning
filters intest.test_importlib.test_metadata_api.APITests.test_entry_points_by_index
to avoidStopIteration
error ifDeprecationWarnings
are ignored.bpo-44363 [https://bugs.python.org/issue?@action=redirect&bpo=44363]: Account for address sanitizer in test_capi. test_capi now passes when run GCC address sanitizer.
bpo-44364 [https://bugs.python.org/issue?@action=redirect&bpo=44364]: Add non integral tests for
math.sqrt()
function.bpo-43921 [https://bugs.python.org/issue?@action=redirect&bpo=43921]: Fix test_ssl.test_wrong_cert_tls13(): use
suppress_ragged_eofs=False
, sinceread()
can raisessl.SSLEOFError
on Windows. Patch by Victor Stinner.bpo-43921 [https://bugs.python.org/issue?@action=redirect&bpo=43921]: Fix test_pha_required_nocert() of test_ssl: catch two more EOF cases (when the
recv()
method returns an empty string). Patch by Victor Stinner.bpo-44131 [https://bugs.python.org/issue?@action=redirect&bpo=44131]: Add test_frozenmain to test_embed to test the
Py_FrozenMain()
C function. Patch by Victor Stinner.bpo-31904 [https://bugs.python.org/issue?@action=redirect&bpo=31904]: Ignore error string case in test_file_not_exists().
bpo-42083 [https://bugs.python.org/issue?@action=redirect&bpo=42083]: Add test to check that
PyStructSequence_NewType
accepts aPyStructSequence_Desc
withdoc
field set toNULL
.bpo-35753 [https://bugs.python.org/issue?@action=redirect&bpo=35753]: Fix crash in doctest when doctest parses modules that include unwrappable functions by skipping those functions.
bpo-30256 [https://bugs.python.org/issue?@action=redirect&bpo=30256]: Add test for nested queues when using
multiprocessing
shared objectsAutoProxy[Queue]
insideListProxy
andDictProxy