构建
bpo-45220 [https://bugs.python.org/issue?@action=redirect&bpo=45220]: Avoid building with the Windows 11 SDK previews automatically. This may be overridden by setting the
DefaultWindowsSDKVersion
environment variable before building.bpo-45020 [https://bugs.python.org/issue?@action=redirect&bpo=45020]: Freeze stdlib modules that are imported during startup. This provides significant performance improvements to startup. If necessary, use the previously added "-X frozen_modules=off" commandline option to force importing the source modules.
bpo-45188 [https://bugs.python.org/issue?@action=redirect&bpo=45188]: Windows builds now regenerate frozen modules as the first part of the build. Previously the regeneration was later in the build, which would require it to be restarted if any modules had changed.
bpo-45163 [https://bugs.python.org/issue?@action=redirect&bpo=45163]: Fixes Haiku platform build.
bpo-45067 [https://bugs.python.org/issue?@action=redirect&bpo=45067]: The ncurses function extended_color_content was introduced in 2017
(https://invisible-island.net/ncurses/NEWS.html#index-t20170401). The ncurses-devel package in CentOS 7 had a older version ncurses resulted in compilation error. For compiling ncurses with extended color support, we verify the version of the ncurses library >= 20170401.
bpo-45019 [https://bugs.python.org/issue?@action=redirect&bpo=45019]: Generate lines in relevant files for frozen modules. Up until now each of the files had to be edited manually. This change makes it easier to add to and modify the frozen modules.
bpo-44340 [https://bugs.python.org/issue?@action=redirect&bpo=44340]: Add support for building with clang thin lto via —with-lto=thin/full. Patch by Donghee Na and Brett Holman.
bpo-44535 [https://bugs.python.org/issue?@action=redirect&bpo=44535]: Enable building using a Visual Studio 2022 install on Windows.
bpo-43298 [https://bugs.python.org/issue?@action=redirect&bpo=43298]: Improved error message when building without a Windows SDK installed.
bpo-44381 [https://bugs.python.org/issue?@action=redirect&bpo=44381]: The Windows build now accepts
EnableControlFlowGuard
set toguard
to enable CFG.bpo-41282 [https://bugs.python.org/issue?@action=redirect&bpo=41282]: Fix broken
make install
that caused standard library extension modules to be unnecessarily and incorrectly rebuilt during the install phase of cpython.
Windows
bpo-45375 [https://bugs.python.org/issue?@action=redirect&bpo=45375]: Fixes an assertion failure due to searching for the standard library in unnormalised paths.
bpo-45022 [https://bugs.python.org/issue?@action=redirect&bpo=45022]: Update Windows release to include libffi 3.4.2
bpo-45007 [https://bugs.python.org/issue?@action=redirect&bpo=45007]: Update to OpenSSL 1.1.1l in Windows build
bpo-44848 [https://bugs.python.org/issue?@action=redirect&bpo=44848]: Upgrade Windows installer to use SQLite 3.36.0.
bpo-44572 [https://bugs.python.org/issue?@action=redirect&bpo=44572]: Avoid consuming standard input in the
platform
modulebpo-44582 [https://bugs.python.org/issue?@action=redirect&bpo=44582]: Accelerate speed of
mimetypes
initialization using a native implementation of the registry scan.bpo-41299 [https://bugs.python.org/issue?@action=redirect&bpo=41299]: Fix 16 milliseconds jitter when using timeouts in
threading
, such as withthreading.Lock.acquire()
orthreading.Condition.wait()
.bpo-42686 [https://bugs.python.org/issue?@action=redirect&bpo=42686]: Build
sqlite3
with math functions enabled. Patch by Erlend E. Aasland.bpo-40263 [https://bugs.python.org/issue?@action=redirect&bpo=40263]: This is a follow-on bug from https://bugs.python.org/issue26903. Once that is applied we run into an off-by-one assertion problem. The assert was not correct.
macOS
bpo-45007 [https://bugs.python.org/issue?@action=redirect&bpo=45007]: Update macOS installer builds to use OpenSSL 1.1.1l.
bpo-34602 [https://bugs.python.org/issue?@action=redirect&bpo=34602]: When building CPython on macOS with
./configure --with-undefined-behavior-sanitizer --with-pydebug
, the stack size is now quadrupled to allow for the entire test suite to pass.bpo-44848 [https://bugs.python.org/issue?@action=redirect&bpo=44848]: Update macOS installer to use SQLite 3.36.0.
bpo-44689 [https://bugs.python.org/issue?@action=redirect&bpo=44689]:
ctypes.util.find_library()
now works correctly on macOS 11 Big Sur even if Python is built on an older version of macOS. Previously, when built on older macOS systems,find_library
was not able to find macOS system libraries when running on Big Sur due to changes in how system libraries are stored.bpo-41972 [https://bugs.python.org/issue?@action=redirect&bpo=41972]: The framework build's user header path in sysconfig is changed to add a 'pythonX.Y' component to match distutils's behavior.
bpo-43109 [https://bugs.python.org/issue?@action=redirect&bpo=43109]: Allow —with-lto configure option to work with Apple-supplied Xcode or Command Line Tools.
bpo-34932 [https://bugs.python.org/issue?@action=redirect&bpo=34932]: Add socket.TCP_KEEPALIVE support for macOS. Patch by Shane Harvey.
IDLE
bpo-45296 [https://bugs.python.org/issue?@action=redirect&bpo=45296]: On Windows, change exit/quit message to suggest Ctrl-D, which works, instead of
, which does not work in IDLE. bpo-45193 [https://bugs.python.org/issue?@action=redirect&bpo=45193]: Make completion boxes appear on Ubuntu again.
bpo-40128 [https://bugs.python.org/issue?@action=redirect&bpo=40128]: Mostly fix completions on macOS when not using tcl/tk 8.6.11 (as with 3.9). The added update_idletask call should be harmless and possibly helpful otherwise.
bpo-33962 [https://bugs.python.org/issue?@action=redirect&bpo=33962]: Move the indent space setting from the Font tab to the new Windows tab. Patch by Mark Roseman and Terry Jan Reedy.
bpo-40468 [https://bugs.python.org/issue?@action=redirect&bpo=40468]: Split the settings dialog General tab into Windows and Shell/ED tabs. Move help sources, which extend the Help menu, to the Extensions tab. Make space for new options and shorten the dialog. The latter makes the dialog better fit small screens.
bpo-41611 [https://bugs.python.org/issue?@action=redirect&bpo=41611]: Avoid uncaught exceptions in
AutoCompleteWindow.winconfig_event()
.bpo-41611 [https://bugs.python.org/issue?@action=redirect&bpo=41611]: Fix IDLE sometimes freezing upon tab-completion on macOS.
bpo-44010 [https://bugs.python.org/issue?@action=redirect&bpo=44010]: Highlight the new match statement's soft keywords:
match
,case
, and_
. However, this highlighting is not perfect and will be incorrect in some rare cases, including some_
-s incase
patterns.bpo-44026 [https://bugs.python.org/issue?@action=redirect&bpo=44026]: Include interpreter's typo fix suggestions in message line for NameErrors and AttributeErrors. Patch by E. Paine.
工具/示例
bpo-44786 [https://bugs.python.org/issue?@action=redirect&bpo=44786]: Fix a warning in regular expression in the c-analyzer script.
bpo-44967 [https://bugs.python.org/issue?@action=redirect&bpo=44967]: pydoc now returns a non-zero status code when a module cannot be found.
bpo-44978 [https://bugs.python.org/issue?@action=redirect&bpo=44978]: Allow the Argument Clinic tool to handle
__complex__
special methods.bpo-43425 [https://bugs.python.org/issue?@action=redirect&bpo=43425]: Removed the 'test2to3' demo project that demonstrated using lib2to3 to support Python 2.x and Python 3.x from a single source in a distutils package. Patch by Donghee Na
bpo-44074 [https://bugs.python.org/issue?@action=redirect&bpo=44074]: Make patchcheck automatically detect the correct base branch name (previously it was hardcoded to 'master')
bpo-20291 [https://bugs.python.org/issue?@action=redirect&bpo=20291]: Added support for variadic positional parameters in Argument Clinic.
C API
bpo-41710 [https://bugs.python.org/issue?@action=redirect&bpo=41710]: The PyThread_acquire_lock_timed() function now clamps the timeout if it is too large, rather than aborting the process. Patch by Victor Stinner.
bpo-44687 [https://bugs.python.org/issue?@action=redirect&bpo=44687]:
BufferedReader.peek()
no longer raisesValueError
when the entire file has already been buffered.bpo-45116 [https://bugs.python.org/issue?@action=redirect&bpo=45116]: Add the
Py_ALWAYS_INLINE
macro to ask the compiler to always inline a static inline function. The compiler can ignore it and decides to not inline the function. Patch by Victor Stinner.bpo-45094 [https://bugs.python.org/issue?@action=redirect&bpo=45094]: Add the
Py_NO_INLINE
macro to disable inlining on a function. Patch by Victor Stinner.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 callPy_DECREF(Py_True);
orPy_DECREF(Py_False);
by mistake. Patch by Victor Stinner.bpo-42035 [https://bugs.python.org/issue?@action=redirect&bpo=42035]: Add a new
PyType_GetQualName()
function to get type's qualified name.bpo-41103 [https://bugs.python.org/issue?@action=redirect&bpo=41103]: Reverts removal of the old buffer protocol because they are part of stable ABI.
bpo-44751 [https://bugs.python.org/issue?@action=redirect&bpo=44751]: Remove
crypt.h
include from the publicPython.h
header.bpo-42747 [https://bugs.python.org/issue?@action=redirect&bpo=42747]: The
Py_TPFLAGS_HAVE_VERSION_TAG
type flag now does nothing. ThePy_TPFLAGS_HAVE_AM_SEND
flag (which was added in 3.10) is removed. Both were unnecessary because it is not possible to have type objects with the relevant fields missing.bpo-44530 [https://bugs.python.org/issue?@action=redirect&bpo=44530]: Added the
co_qualname
to thePyCodeObject
structure to propagate the qualified name from the compiler to code objects.
Patch by Gabriele N. Tornetta
bpo-44441 [https://bugs.python.org/issue?@action=redirect&bpo=44441]:
Py_RunMain()
now resetsPyImport_Inittab
to its initial value at exit. It must be possible to callPyImport_AppendInittab()
orPyImport_ExtendInittab()
at each Python initialization. Patch by Victor Stinner.bpo-39947 [https://bugs.python.org/issue?@action=redirect&bpo=39947]: Remove 4 private trashcan C API functions which were only kept for the backward compatibility of the stable ABI with Python 3.8 and older, since the trashcan API was not usable with the limited C API on Python 3.8 and older. The trashcan API was excluded from the limited C API in Python 3.9.
Removed functions:
PyTrashdeposit_object()
PyTrashdestroy_chain()
PyTrashthread_deposit_object()
PyTrashthread_destroy_chain()
The trashcan C API was never usable with the limited C API, since old trashcan macros accessed directly PyThreadState
members like tstate->trashdelete_nesting
, whereas the PyThreadState
structure is opaque in the limited C API.
Exclude also the PyTrash_UNWIND_LEVEL
constant from the C API.
Patch by Victor Stinner.
bpo-40939 [https://bugs.python.org/issue?@action=redirect&bpo=40939]: Removed documentation for the removed
PyParser_*
C API.bpo-43795 [https://bugs.python.org/issue?@action=redirect&bpo=43795]: The list in 受限 API 的内容 now shows the public name
PyFrameObject
rather than_frame
. The nonexisting entry_node
no longer appears in the list.bpo-44378 [https://bugs.python.org/issue?@action=redirect&bpo=44378]:
Py_IS_TYPE()
no longer usesPy_TYPE()
to avoid a compiler warning: no longer castconst PyObject*
toPyObject*
. Patch by Victor Stinner.bpo-39573 [https://bugs.python.org/issue?@action=redirect&bpo=39573]: Convert the
Py_TYPE()
andPy_SIZE()
macros to static inline functions. ThePy_SET_TYPE()
andPy_SET_SIZE()
functions must now be used to set an object type and size. Patch by Victor Stinner.bpo-44263 [https://bugs.python.org/issue?@action=redirect&bpo=44263]: The
PyType_Ready()
function now raises an error if a type is defined with thePy_TPFLAGS_HAVE_GC
flag set but has no traverse function (PyTypeObject.tp_traverse
). Patch by Victor Stinner.bpo-43795 [https://bugs.python.org/issue?@action=redirect&bpo=43795]: The undocumented function
Py_FrozenMain()
is removed from the Limited API.bpo-44113 [https://bugs.python.org/issue?@action=redirect&bpo=44113]: Deprecate the following functions to configure the Python initialization:
PySys_AddWarnOptionUnicode()
PySys_AddWarnOption()
PySys_AddXOption()
PySys_HasWarnOptions()
Py_SetPath()
Py_SetProgramName()
Py_SetPythonHome()
Py_SetStandardStreamEncoding()
PySetProgramFullPath()
Use the new PyConfig
API of the Python Initialization Configuration instead ( PEP 587 [https://peps.python.org/pep-0587/]).
bpo-44094 [https://bugs.python.org/issue?@action=redirect&bpo=44094]: Remove
PyErr_SetFromErrnoWithUnicodeFilename()
,PyErr_SetFromWindowsErrWithUnicodeFilename()
, andPyErr_SetExcFromWindowsErrWithUnicodeFilename()
. They are not documented and have been deprecated since Python 3.3.bpo-43795 [https://bugs.python.org/issue?@action=redirect&bpo=43795]:
PyCodec_Unregister()
is now properly exported as a function in the Windows Stable ABI DLL.bpo-44029 [https://bugs.python.org/issue?@action=redirect&bpo=44029]: Remove deprecated
Py_UNICODE
APIs:PyUnicode_Encode
,PyUnicode_EncodeUTF7
,PyUnicode_EncodeUTF8
,PyUnicode_EncodeUTF16
,PyUnicode_EncodeUTF32
,PyUnicode_EncodeLatin1
,PyUnicode_EncodeMBCS
,PyUnicode_EncodeDecimal
,PyUnicode_EncodeRawUnicodeEscape
,PyUnicode_EncodeCharmap
,PyUnicode_EncodeUnicodeEscape
,PyUnicode_TransformDecimalToASCII
,PyUnicode_TranslateCharmap
,PyUnicodeEncodeError_Create
,PyUnicodeTranslateError_Create
. See PEP 393 [https://peps.python.org/pep-0393/] and PEP 624 [https://peps.python.org/pep-0624/] for reference.bpo-42035 [https://bugs.python.org/issue?@action=redirect&bpo=42035]: Add a new
PyType_GetName()
function to get type's short name.
Python 3.10.0 beta 1
发布日期: 2021-05-03
安全性
bpo-43434 [https://bugs.python.org/issue?@action=redirect&bpo=43434]: Creating
sqlite3.Connection
objects now also producessqlite3.connect
andsqlite3.connect/handle
auditing events. Previously these events were only produced bysqlite3.connect()
calls. Patch by Erlend E. Aasland.bpo-43998 [https://bugs.python.org/issue?@action=redirect&bpo=43998]: The
ssl
module sets more secure cipher suites defaults. Ciphers without forward secrecy and with SHA-1 MAC are disabled by default. Security level 2 prohibits weak RSA, DH, and ECC keys with less than 112 bits of security.SSLContext
defaults to minimum protocol version TLS 1.2. Settings are based on Hynek Schlawack's research.bpo-43882 [https://bugs.python.org/issue?@action=redirect&bpo=43882]: The presence of newline or tab characters in parts of a URL could allow some forms of attacks.
Following the controlling specification for URLs defined by WHATWG urllib.parse()
now removes ASCII newlines and tabs from URLs, preventing such attacks.
bpo-43472 [https://bugs.python.org/issue?@action=redirect&bpo=43472]: Ensures interpreter-level audit hooks receive the
cpython.PyInterpreterState_New
event when called through the_xxsubinterpreters
module.bpo-43362 [https://bugs.python.org/issue?@action=redirect&bpo=43362]: Fix invalid free in _sha3 module. The issue was introduced in 3.10.0a1. Python 3.9 and earlier are not affected.
bpo-43762 [https://bugs.python.org/issue?@action=redirect&bpo=43762]: Add audit events for
sqlite3.connect/handle()
,sqlite3.Connection.enableloadextension()
, andsqlite3.Connection.load_extension()
. Patch by Erlend E. Aasland.bpo-43756 [https://bugs.python.org/issue?@action=redirect&bpo=43756]: Add new audit event
glob.glob/2
to incorporate the new root_dir and dir_fd arguments added toglob.glob()
andglob.iglob()
.bpo-36384 [https://bugs.python.org/issue?@action=redirect&bpo=36384]:
ipaddress
module no longer accepts any leading zeros in IPv4 address strings. Leading zeros are ambiguous and interpreted as octal notation by some libraries. For example the legacy functionsocket.inet_aton()
treats leading zeros as octal notation. glibc implementation of moderninet_pton()
does not accept any leading zeros. For a while theipaddress
module used to accept ambiguous leading zeros.bpo-43075 [https://bugs.python.org/issue?@action=redirect&bpo=43075]: Fix Regular Expression Denial of Service (ReDoS) vulnerability in
urllib.request.AbstractBasicAuthHandler
. The ReDoS-vulnerable regex has quadratic worst-case complexity and it allows cause a denial of service when identifying crafted invalid RFCs. This ReDoS issue is on the client side and needs remote attackers to control the HTTP server.bpo-42800 [https://bugs.python.org/issue?@action=redirect&bpo=42800]: Audit hooks are now fired for frame.f_code, traceback.tb_frame, and generator code/frame attribute access.
bpo-37363 [https://bugs.python.org/issue?@action=redirect&bpo=37363]: Add audit events to the
http.client
module.
核心与内置函数
bpo-43977 [https://bugs.python.org/issue?@action=redirect&bpo=43977]: Prevent classes being both a sequence and a mapping when pattern matching.
bpo-43977 [https://bugs.python.org/issue?@action=redirect&bpo=43977]: Use
tp_flags
on the class object to determine if the subject is a sequence or mapping when pattern matching. Avoids the need to importcollections.abc
when pattern matching.bpo-43892 [https://bugs.python.org/issue?@action=redirect&bpo=43892]: Restore proper validation of complex literal value patterns when parsing
match
blocks.bpo-43933 [https://bugs.python.org/issue?@action=redirect&bpo=43933]: Set frame.flineno to the line number of the 'with' kweyword when executing the call to
\
_exit__
.bpo-43933 [https://bugs.python.org/issue?@action=redirect&bpo=43933]: If the current position in a frame has no line number then set the f_lineno attribute to None, instead of -1, to conform to PEP 626. This should not normally be possible, but might occur in some unusual circumstances.
bpo-43963 [https://bugs.python.org/issue?@action=redirect&bpo=43963]: Importing the
_signal
module in a subinterpreter has no longer side effects.bpo-42739 [https://bugs.python.org/issue?@action=redirect&bpo=42739]: The internal representation of line number tables is changed to not use sentinels, and an explicit length parameter is added to the out of process API function
PyLineTable_InitAddressRange
. This makes the handling of line number tables more robust in some circumstances.bpo-43908 [https://bugs.python.org/issue?@action=redirect&bpo=43908]: Make
re
types immutable. Patch by Erlend E. Aasland.bpo-43908 [https://bugs.python.org/issue?@action=redirect&bpo=43908]: Make the
array.array
type immutable. Patch by Erlend E. Aasland.bpo-43901 [https://bugs.python.org/issue?@action=redirect&bpo=43901]: Change class and module objects to lazy-create empty annotations dicts on demand. The annotations dicts are stored in the object's dict for backwards compatibility.
bpo-43892 [https://bugs.python.org/issue?@action=redirect&bpo=43892]: Match patterns now use new dedicated AST nodes (
MatchValue
,MatchSingleton
,MatchSequence
,MatchStar
,MatchMapping
,MatchClass
) rather than reusing expression AST nodes.MatchAs
andMatchOr
are now defined as pattern nodes rather than as expression nodes. Patch by Nick Coghlan.bpo-42725 [https://bugs.python.org/issue?@action=redirect&bpo=42725]: Usage of
await
/yield
/yield from
and named expressions within an annotation is now forbidden when PEP 563 is activated.bpo-43754 [https://bugs.python.org/issue?@action=redirect&bpo=43754]: When performing structural pattern matching ( PEP 634 [https://peps.python.org/pep-0634/]), captured names are now left unbound until the entire pattern has matched successfully.
bpo-42737 [https://bugs.python.org/issue?@action=redirect&bpo=42737]: Annotations for complex targets (everything beside simple names) no longer cause any runtime effects with
from __future__ import annotations
.bpo-43914 [https://bugs.python.org/issue?@action=redirect&bpo=43914]:
SyntaxError
exceptions raised by the interpreter will highlight the full error range of the expression that constitutes the syntax error itself, instead of just where the problem is detected. Patch by Pablo Galindo.bpo-38605 [https://bugs.python.org/issue?@action=redirect&bpo=38605]: Revert making
from __future__ import annotations
the default. This follows the Steering Council decision to postpone PEP 563 changes to at least Python 3.11. See the original email for more information regarding the decision: https://mail.python.org/archives/list/python-dev@python.org/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/. Patch by Pablo Galindo.bpo-43475 [https://bugs.python.org/issue?@action=redirect&bpo=43475]: Hashes of NaN values now depend on object identity. Formerly, they always hashed to 0 even though NaN values are not equal to one another. Having the same hash for unequal values caused pile-ups in hash tables.
bpo-43859 [https://bugs.python.org/issue?@action=redirect&bpo=43859]: Improve the error message for
IndentationError
exceptions. Patch by Pablo Galindobpo-41323 [https://bugs.python.org/issue?@action=redirect&bpo=41323]: Constant tuple folding in bytecode optimizer now reuses tuple in constant table.
bpo-43846 [https://bugs.python.org/issue?@action=redirect&bpo=43846]: Data stack usage is much reduced for large literal and call expressions.
bpo-38530 [https://bugs.python.org/issue?@action=redirect&bpo=38530]: When printing
NameError
raised by the interpreter,PyErr_Display()
will offer suggestions of similar variable names in the function that the exception was raised from. Patch by Pablo Galindobpo-43823 [https://bugs.python.org/issue?@action=redirect&bpo=43823]: Improve syntax errors for invalid dictionary literals. Patch by Pablo Galindo.
bpo-43822 [https://bugs.python.org/issue?@action=redirect&bpo=43822]: Improve syntax errors in the parser for missing commas between expressions. Patch by Pablo Galindo.
bpo-43798 [https://bugs.python.org/issue?@action=redirect&bpo=43798]:
ast.alias
nodes now include source location metadata attributes e.g. lineno, col_offset.bpo-43797 [https://bugs.python.org/issue?@action=redirect&bpo=43797]: Improve
SyntaxError
error messages for invalid comparisons. Patch by Pablo Galindo.bpo-43760 [https://bugs.python.org/issue?@action=redirect&bpo=43760]: Move the flag for checking whether tracing is enabled to the C stack, from the heap. Should speed up dispatch in the interpreter.
bpo-43682 [https://bugs.python.org/issue?@action=redirect&bpo=43682]: Static methods (
@staticmethod
) and class methods (@classmethod
) now inherit the method attributes (__module__
,__name__
,__qualname__
,__doc__
,__annotations__
) and have a new__wrapped__
attribute. Patch by Victor Stinner.bpo-43751 [https://bugs.python.org/issue?@action=redirect&bpo=43751]: Fixed a bug where
anext(ait, default)
would erroneously return None.bpo-42128 [https://bugs.python.org/issue?@action=redirect&bpo=42128]:
__match_args__
is no longer allowed to be a list.bpo-43683 [https://bugs.python.org/issue?@action=redirect&bpo=43683]: Add GEN_START opcode. Marks start of generator, including async, or coroutine and handles sending values to a newly created generator or coroutine.
bpo-43105 [https://bugs.python.org/issue?@action=redirect&bpo=43105]: Importlib now resolves relative paths when creating module spec objects from file locations.
bpo-43682 [https://bugs.python.org/issue?@action=redirect&bpo=43682]: Static methods (
@staticmethod
) are now callable as regular functions. Patch by Victor Stinner.bpo-42609 [https://bugs.python.org/issue?@action=redirect&bpo=42609]: Prevented crashes in the AST validator and optimizer when compiling some absurdly long expressions like
"+0"*1000000
.RecursionError
is now raised instead.bpo-38530 [https://bugs.python.org/issue?@action=redirect&bpo=38530]: When printing
AttributeError
,PyErr_Display()
will offer suggestions of similar attribute names in the object that the exception was raised from. Patch by Pablo Galindo
库
bpo-44015 [https://bugs.python.org/issue?@action=redirect&bpo=44015]: In @dataclass(), raise a TypeError if KW_ONLY is specified more than once.
bpo-25478 [https://bugs.python.org/issue?@action=redirect&bpo=25478]: Added a total() method to collections.Counter() to compute the sum of the counts.
bpo-43733 [https://bugs.python.org/issue?@action=redirect&bpo=43733]: Change
netrc.netrc
to use UTF-8 encoding before using locale encoding.bpo-43979 [https://bugs.python.org/issue?@action=redirect&bpo=43979]: Removed an unnecessary list comprehension before looping from
urllib.parse.parse_qsl()
. Patch by Christoph Zwerschke and Donghee Na.bpo-43993 [https://bugs.python.org/issue?@action=redirect&bpo=43993]: Update bundled pip to 21.1.1.
bpo-43957 [https://bugs.python.org/issue?@action=redirect&bpo=43957]: [Enum] Deprecate
TypeError
when nonmember is used in a containment check; In 3.12True
orFalse
will be returned instead, and containment will returnTrue
if the value is either a member of that enum or one of its members' value.bpo-42904 [https://bugs.python.org/issue?@action=redirect&bpo=42904]: For backwards compatibility with previous minor versions of Python, if
typing.get_type_hints()
receives no namespace dictionary arguments,typing.get_type_hints()
will search through the global then local namespaces during evaluation of stringized type annotations (string forward references) inside a class.bpo-43945 [https://bugs.python.org/issue?@action=redirect&bpo=43945]: [Enum] Deprecate non-standard mixin format() behavior: in 3.12 the enum member, not the member's value, will be used for format() calls.
bpo-41139 [https://bugs.python.org/issue?@action=redirect&bpo=41139]: Deprecate undocumented
cgi.log()
API.bpo-43937 [https://bugs.python.org/issue?@action=redirect&bpo=43937]: Fixed the
turtle
module working with non-default root window.bpo-43930 [https://bugs.python.org/issue?@action=redirect&bpo=43930]: Update bundled pip to 21.1 and setuptools to 56.0.0
bpo-43907 [https://bugs.python.org/issue?@action=redirect&bpo=43907]: Fix a bug in the pure-Python pickle implementation when using protocol 5, where bytearray instances that occur several time in the pickled object graph would incorrectly unpickle into repeated copies of the bytearray object.
bpo-43926 [https://bugs.python.org/issue?@action=redirect&bpo=43926]: In
importlib.metadata
, provide a uniform interface toDescription
, allow for any field to be encoded with multiline values, remove continuation lines from multiline values, and add a.json
property for easy access to the PEP 566 JSON-compatible form. Sync withimportlib_metadata 4.0
.bpo-43920 [https://bugs.python.org/issue?@action=redirect&bpo=43920]: OpenSSL 3.0.0:
load_verify_locations()
now returns a consistent error message when cadata contains no valid certificate.bpo-43607 [https://bugs.python.org/issue?@action=redirect&bpo=43607]:
urllib
can now convert Windows paths with\?\
prefixes into URL paths.bpo-43817 [https://bugs.python.org/issue?@action=redirect&bpo=43817]: Add
inspect.get_annotations()
, which safely computes the annotations defined on an object. It works around the quirks of accessing the annotations from various types of objects, and makes very few assumptions about the object passed in.inspect.get_annotations()
can also correctly un-stringize stringized annotations.
inspect.signature()
, inspect.from_callable()
, and inspect.from_function()
now call inspect.get_annotations()
to retrieve annotations. This means inspect.signature()
and inspect.from_callable()
can now un-stringize stringized annotations, too.
bpo-43284 [https://bugs.python.org/issue?@action=redirect&bpo=43284]: platform.win32_ver derives the windows version from sys.getwindowsversion().platform_version which in turn derives the version from kernel32.dll (which can be of a different version than Windows itself). Therefore change the platform.win32_ver to determine the version using the platform module's syscmdver private function to return an accurate version.
bpo-42854 [https://bugs.python.org/issue?@action=redirect&bpo=42854]: The
ssl
module now usesSSLreadex
andSSLwriteex
internally. The functions support reading and writing of data larger than 2 GB. Writing zero-length data no longer fails with a protocol violation error.bpo-42333 [https://bugs.python.org/issue?@action=redirect&bpo=42333]: Port
_ssl
extension module to multiphase initialization.bpo-43880 [https://bugs.python.org/issue?@action=redirect&bpo=43880]:
ssl
now raises DeprecationWarning for OP_NO_SSL/TLS* options, old TLS versions, old protocols, and other features that have been deprecated since Python 3.6, 3.7, or OpenSSL 1.1.0.bpo-41559 [https://bugs.python.org/issue?@action=redirect&bpo=41559]: PEP 612 [https://peps.python.org/pep-0612/] is now implemented purely in Python; builtin
types.GenericAlias
objects no longer includetyping.ParamSpec
in__parameters__
(with the exception ofcollections.abc.Callable
'sGenericAlias
). This means previously invalid uses ofParamSpec
(such aslist[P]
) which worked in earlier versions of Python 3.10 alpha, will now raiseTypeError
during substitution.bpo-43867 [https://bugs.python.org/issue?@action=redirect&bpo=43867]: The
multiprocessing
Server
class now explicitly catchesSystemExit
and closes the client connection in this case. It happens when theServer.serve_client()
method reaches the end of file (EOF).bpo-40443 [https://bugs.python.org/issue?@action=redirect&bpo=40443]: Remove unused imports: pyclbr no longer uses copy, and typing no longer uses ast. Patch by Victor Stinner.
bpo-43820 [https://bugs.python.org/issue?@action=redirect&bpo=43820]: Remove an unneeded copy of the namespace passed to dataclasses.make_dataclass().
bpo-43787 [https://bugs.python.org/issue?@action=redirect&bpo=43787]: Add
__iter__()
method tobz2.BZ2File
,gzip.GzipFile
, andlzma.LZMAFile
. It makes iterating them about 2x faster. Patch by Inada Naoki.bpo-43680 [https://bugs.python.org/issue?@action=redirect&bpo=43680]: Deprecate io.OpenWrapper and pyio.OpenWrapper: use io.open and pyio.open instead. Until Python 3.9, pyio.open was not a static method and builtins.open was set to OpenWrapper to not become a bound method when set to a class variable. io.open is a builtin function whereas pyio.open is a Python function. In Python 3.10, pyio.open() is now a static method, and builtins.open() is now io.open().
bpo-43680 [https://bugs.python.org/issue?@action=redirect&bpo=43680]: The Python
_pyio.open()
function becomes a static method to behave asio.open()
builtin function: don't become a bound method when stored as a class variable. It becomes possible since static methods are now callable in Python 3.10. Moreover,_pyio.OpenWrapper()
becomes a simple alias to_pyio.open()
. Patch by Victor Stinner.bpo-41515 [https://bugs.python.org/issue?@action=redirect&bpo=41515]: Fix
KeyError
raised intyping.get_type_hints()
due to synthetic modules that don't appear insys.modules
.bpo-43776 [https://bugs.python.org/issue?@action=redirect&bpo=43776]: When
subprocess.Popen
args are provided as a string or aspathlib.Path
, the Popen instance repr now shows the right thing.bpo-42248 [https://bugs.python.org/issue?@action=redirect&bpo=42248]: [Enum] ensure exceptions raised in
missing_
are releasedbpo-43744 [https://bugs.python.org/issue?@action=redirect&bpo=43744]: fix issue with enum member name matching the start of a private variable name
bpo-43772 [https://bugs.python.org/issue?@action=redirect&bpo=43772]: Fixed the return value of
TypeVar.__ror__
. Patch by Jelle Zijlstra.bpo-43764 [https://bugs.python.org/issue?@action=redirect&bpo=43764]: Add matchargs parameter to @dataclass decorator to allow suppression of _match_args generation.
bpo-43799 [https://bugs.python.org/issue?@action=redirect&bpo=43799]: OpenSSL 3.0.0: define
OPENSSL_API_COMPAT
1.1.1 to suppress deprecation warnings. Python requires OpenSSL 1.1.1 APIs.bpo-43478 [https://bugs.python.org/issue?@action=redirect&bpo=43478]: Mocks can no longer be used as the specs for other Mocks. As a result, an already-mocked object cannot have an attribute mocked using
autospec=True
or be the subject of acreate_autospec(…)
call. This can uncover bugs in tests since these Mock-derived Mocks will always pass certain tests (e.g.isinstance()
) and builtin assert functions (e.g. assert_called_once_with) will unconditionally pass.bpo-43794 [https://bugs.python.org/issue?@action=redirect&bpo=43794]: Add
ssl.OP_IGNORE_UNEXPECTED_EOF
constants (OpenSSL 3.0.0)bpo-43785 [https://bugs.python.org/issue?@action=redirect&bpo=43785]: Improve
bz2.BZ2File
performance by removing the RLock from BZ2File. This makes BZ2File thread unsafe in the face of multiple simultaneous readers or writers, just like its equivalent classes ingzip
andlzma
have always been. Patch by Inada Naoki.bpo-43789 [https://bugs.python.org/issue?@action=redirect&bpo=43789]: OpenSSL 3.0.0: Don't call the password callback function a second time when first call has signaled an error condition.
bpo-43788 [https://bugs.python.org/issue?@action=redirect&bpo=43788]: The header files for
ssl
error codes are now OpenSSL version-specific. Exceptions will now show correct reason and library codes. Themake_ssl_data.py
script has been rewritten to use OpenSSL's text file with error codes.bpo-43766 [https://bugs.python.org/issue?@action=redirect&bpo=43766]: Implement PEP 647 [https://peps.python.org/pep-0647/] in the
typing
module by addingTypeGuard
.bpo-25264 [https://bugs.python.org/issue?@action=redirect&bpo=25264]:
os.path.realpath()
now accepts a strict keyword-only argument. When set toTrue
,OSError
is raised if a path doesn't exist or a symlink loop is encountered.bpo-43780 [https://bugs.python.org/issue?@action=redirect&bpo=43780]: In
importlib.metadata
, incorporate changes from importlib_metadata 3.10: Add mtime-based caching during distribution discovery. Flagged use of dict result fromentry_points()
as deprecated.gh-47383 [https://github.com/python/cpython/issues/47383]: The
P.args
andP.kwargs
attributes oftyping.ParamSpec
are now instances of the new classestyping.ParamSpecArgs
andtyping.ParamSpecKwargs
, which enables a more usefulrepr()
. Patch by Jelle Zijlstra.bpo-43731 [https://bugs.python.org/issue?@action=redirect&bpo=43731]: Add an
encoding
parameterlogging.fileConfig()
.bpo-43712 [https://bugs.python.org/issue?@action=redirect&bpo=43712]: Add
encoding
anderrors
parameters tofileinput.input()
andfileinput.FileInput
.bpo-38659 [https://bugs.python.org/issue?@action=redirect&bpo=38659]: A
simple_enum
decorator is added to theenum
module to convert a normal class into an Enum.testsimpleenum
added to test simple enums against a corresponding normal Enum. Standard library modules updated to usesimple_enum
.bpo-43764 [https://bugs.python.org/issue?@action=redirect&bpo=43764]: Fix an issue where
__match_args__
generation could fail for somedataclasses
.bpo-43752 [https://bugs.python.org/issue?@action=redirect&bpo=43752]: Fix
sqlite3
regression for zero-sized blobs with converters, whereb""
was returned instead ofNone
. The regression was introduced by PR 24723. Patch by Erlend E. Aasland.bpo-43655 [https://bugs.python.org/issue?@action=redirect&bpo=43655]:
tkinter
dialog windows are now recognized as dialogs by window managers on macOS and X Window.bpo-43723 [https://bugs.python.org/issue?@action=redirect&bpo=43723]: The following
threading
methods are now deprecated and should be replaced:currentThread
=>threading.current_thread()
activeCount
=>threading.active_count()
Condition.notifyAll
=>threading.Condition.notify_all()
Event.isSet
=>threading.Event.is_set()
Thread.setName
=>threading.Thread.name
thread.getName
=>threading.Thread.name
Thread.isDaemon
=>threading.Thread.daemon
Thread.setDaemon
=>threading.Thread.daemon
Patch by Jelle Zijlstra.
bpo-2135 [https://bugs.python.org/issue?@action=redirect&bpo=2135]: Deprecate find_module() and find_loader() implementations in importlib and zipimport.
bpo-43534 [https://bugs.python.org/issue?@action=redirect&bpo=43534]:
turtle.textinput()
andturtle.numinput()
create now a transient window working on behalf of the canvas window.bpo-43532 [https://bugs.python.org/issue?@action=redirect&bpo=43532]: Add the ability to specify keyword-only fields to dataclasses. These fields will become keyword-only arguments to the generated init.
bpo-43522 [https://bugs.python.org/issue?@action=redirect&bpo=43522]: Fix problem with
hostname_checks_common_name
. OpenSSL does not copy hostflags from struct SSL_CTX to struct SSL.bpo-8978 [https://bugs.python.org/issue?@action=redirect&bpo=8978]: Improve error message for
tarfile.open()
whenlzma
/bz2
are unavailable. Patch by Anthony Sottile.bpo-42967 [https://bugs.python.org/issue?@action=redirect&bpo=42967]: Allow
bytes
separator
argument inurllib.parse.parse_qs
andurllib.parse.parse_qsl
when parsingstr
query strings. Previously, this raised aTypeError
.bpo-43296 [https://bugs.python.org/issue?@action=redirect&bpo=43296]: Improve
sqlite3
error handling:sqlite3_value_blob()
errors that setSQLITE_NOMEM
now raiseMemoryError
. Patch by Erlend E. Aasland.bpo-43312 [https://bugs.python.org/issue?@action=redirect&bpo=43312]: New functions
sysconfig.get_preferred_scheme()
andsysconfig.get_default_scheme()
are added to query a platform for its preferred "user", "home", and "prefix" (default) scheme names.bpo-43265 [https://bugs.python.org/issue?@action=redirect&bpo=43265]: Improve
sqlite3.Connection.backup()
error handling. The error message for nonexistent target database names is nowunknown database
instead ofSQL logic error
. Patch by Erlend E. Aasland.bpo-41282 [https://bugs.python.org/issue?@action=redirect&bpo=41282]: Install schemes in
distutils.command.install
are now loaded fromsysconfig
.bpo-41282 [https://bugs.python.org/issue?@action=redirect&bpo=41282]:
distutils.sysconfig
has been merged tosysconfig
.bpo-43176 [https://bugs.python.org/issue?@action=redirect&bpo=43176]: Fixed processing of a dataclass that inherits from a frozen dataclass with no fields. It is now correctly detected as an error.
bpo-43080 [https://bugs.python.org/issue?@action=redirect&bpo=43080]:
pprint
now has support fordataclasses.dataclass
. Patch by Lewis Gaul.bpo-39950 [https://bugs.python.org/issue?@action=redirect&bpo=39950]: Add
pathlib.Path.hardlink_to()
method that supersedeslink_to()
. The new method has the same argument order assymlink_to()
.bpo-42904 [https://bugs.python.org/issue?@action=redirect&bpo=42904]:
typing.get_type_hints()
now checks the local namespace of a class when evaluating PEP 563 [https://peps.python.org/pep-0563/] annotations inside said class.bpo-42269 [https://bugs.python.org/issue?@action=redirect&bpo=42269]: Add
slots
parameter todataclasses.dataclass
decorator to automatically generate__slots__
for class. Patch provided by Yurii Karabas.bpo-39529 [https://bugs.python.org/issue?@action=redirect&bpo=39529]: Deprecated use of
asyncio.get_event_loop()
without running event loop. Emit deprecation warning forasyncio
functions which implicitly create aFuture
orTask
objects if there is no running event loop and no explicit loop argument is passed:ensure_future()
,wrap_future()
,gather()
,shield()
,as_completed()
and constructors ofFuture
,Task
,StreamReader
,StreamReaderProtocol
.bpo-18369 [https://bugs.python.org/issue?@action=redirect&bpo=18369]: Certificate and PrivateKey classes were added to the ssl module. Certificates and keys can now be loaded from memory buffer, too.
bpo-41486 [https://bugs.python.org/issue?@action=redirect&bpo=41486]: Use a new output buffer management code for
bz2
/lzma
/zlib
modules, and add.readall()
function to_compression.DecompressReader
class. These bring some performance improvements. Patch by Ma Lin.bpo-31870 [https://bugs.python.org/issue?@action=redirect&bpo=31870]: The
ssl.get_server_certificate()
function now has a timeout parameter.bpo-41735 [https://bugs.python.org/issue?@action=redirect&bpo=41735]: Fix thread locks in zlib module may go wrong in rare case. Patch by Ma Lin.
bpo-36470 [https://bugs.python.org/issue?@action=redirect&bpo=36470]: Fix dataclasses with
InitVar
s andreplace()
. Patch by Claudiu Popa.bpo-40849 [https://bugs.python.org/issue?@action=redirect&bpo=40849]: Expose X509_V_FLAG_PARTIAL_CHAIN ssl flag
bpo-35114 [https://bugs.python.org/issue?@action=redirect&bpo=35114]:
ssl.RAND_status()
now returns a boolean value (as documented) instead of1
or0
.bpo-39906 [https://bugs.python.org/issue?@action=redirect&bpo=39906]:
pathlib.Path.stat()
andchmod()
now accept a follow_symlinks keyword-only argument for consistency with corresponding functions in theos
module.bpo-39899 [https://bugs.python.org/issue?@action=redirect&bpo=39899]:
os.path.expanduser()
now refuses to guess Windows home directories if the basename of current user's home directory does not match their username.
pathlib.Path.expanduser()
and home()
now consistently raise RuntimeError
exception when a home directory cannot be resolved. Previously a KeyError
exception could be raised on Windows when the "USERNAME"
environment variable was unset.
bpo-36076 [https://bugs.python.org/issue?@action=redirect&bpo=36076]: Added SNI support to
ssl.get_server_certificate()
.bpo-38490 [https://bugs.python.org/issue?@action=redirect&bpo=38490]: Covariance, Pearson's correlation, and simple linear regression functionality was added to statistics module. Patch by Tymoteusz Wołodźko.
bpo-33731 [https://bugs.python.org/issue?@action=redirect&bpo=33731]: Provide a locale.localize() function, which converts a normalized number string into a locale format.
bpo-32745 [https://bugs.python.org/issue?@action=redirect&bpo=32745]: Fix a regression in the handling of ctypes'
ctypes.c_wchar_p
type: embedded null characters would cause aValueError
to be raised. Patch by Zackery Spytz.
文档
bpo-43987 [https://bugs.python.org/issue?@action=redirect&bpo=43987]: Add "Annotations Best Practices" document as a new HOWTO.
bpo-43977 [https://bugs.python.org/issue?@action=redirect&bpo=43977]: Document the new
Py_TPFLAGS_MAPPING
andPy_TPFLAGS_SEQUENCE
type flags.bpo-43959 [https://bugs.python.org/issue?@action=redirect&bpo=43959]: The documentation on the PyContextVar C-API was clarified.
bpo-43938 [https://bugs.python.org/issue?@action=redirect&bpo=43938]: Update dataclasses documentation to express that FrozenInstanceError is derived from AttributeError.
bpo-43778 [https://bugs.python.org/issue?@action=redirect&bpo=43778]: Fix the Sphinx glossary_search extension: create the _static/ subdirectory if it doesn't exist.
bpo-43755 [https://bugs.python.org/issue?@action=redirect&bpo=43755]: Update documentation to reflect that unparenthesized lambda expressions can no longer be the expression part in an
if
clause in comprehensions and generator expressions since Python 3.9.bpo-43739 [https://bugs.python.org/issue?@action=redirect&bpo=43739]: Fixing the example code in Doc/extending/extending.rst to declare and initialize the pmodule variable to be of the right type.
测试
bpo-43961 [https://bugs.python.org/issue?@action=redirect&bpo=43961]: Fix test_logging.test_namer_rotator_inheritance() on Windows: use
os.replace()
rather thanos.rename()
. Patch by Victor Stinner.bpo-43842 [https://bugs.python.org/issue?@action=redirect&bpo=43842]: Fix a race condition in the SMTP test of test_logging. Don't close a file descriptor (socket) from a different thread while asyncore.loop() is polling the file descriptor. Patch by Victor Stinner.
bpo-43843 [https://bugs.python.org/issue?@action=redirect&bpo=43843]:
test.libregrtest
now marks a test as ENV_CHANGED (altered the execution environment) if a thread raises an exception but does not catch it. It sets a hook onthreading.excepthook()
. Use--fail-env-changed
option to mark the test as failed. Patch by Victor Stinner.bpo-43811 [https://bugs.python.org/issue?@action=redirect&bpo=43811]: Tests multiple OpenSSL versions on GitHub Actions. Use ccache to speed up testing.
bpo-43791 [https://bugs.python.org/issue?@action=redirect&bpo=43791]: OpenSSL 3.0.0: Disable testing of legacy protocols TLS 1.0 and 1.1. Tests are failing with TLSV1_ALERT_INTERNAL_ERROR.
构建
bpo-43567 [https://bugs.python.org/issue?@action=redirect&bpo=43567]: Improved generated code refresh (AST/tokens/opcodes/keywords) on Windows.
bpo-43669 [https://bugs.python.org/issue?@action=redirect&bpo=43669]: Implement PEP 644 [https://peps.python.org/pep-0644/]. Python now requires OpenSSL 1.1.1 or newer.
Windows
bpo-35306 [https://bugs.python.org/issue?@action=redirect&bpo=35306]: Adds additional arguments to
os.startfile()
function.bpo-43538 [https://bugs.python.org/issue?@action=redirect&bpo=43538]: Avoid raising errors from
pathlib.Path.exists()
when passed an invalid filename.bpo-38822 [https://bugs.python.org/issue?@action=redirect&bpo=38822]: Fixed
os.stat()
failing on inaccessible directories with a trailing slash, rather than falling back to the parent directory's metadata. This implicitly affectedos.path.exists()
andos.path.isdir()
.bpo-26227 [https://bugs.python.org/issue?@action=redirect&bpo=26227]: Fixed decoding of host names in
socket.gethostbyaddr()
andsocket.gethostbyname_ex()
.bpo-40432 [https://bugs.python.org/issue?@action=redirect&bpo=40432]: Updated pegen regeneration script on Windows to find and use Python 3.8 or higher. Prior to this, pegen regeneration already required 3.8 or higher, but the script may have used lower versions of Python.
bpo-43745 [https://bugs.python.org/issue?@action=redirect&bpo=43745]: Actually updates Windows release to OpenSSL 1.1.1k. Earlier releases were mislabelled and actually included 1.1.1i again.
bpo-43652 [https://bugs.python.org/issue?@action=redirect&bpo=43652]: Update Tcl and Tk to 8.6.11 in Windows installer.
bpo-43492 [https://bugs.python.org/issue?@action=redirect&bpo=43492]: Upgrade Windows installer to use SQLite 3.35.5.
bpo-30555 [https://bugs.python.org/issue?@action=redirect&bpo=30555]: Fix
WindowsConsoleIO
errors in the presence of fd redirection. Patch by Segev Finer.
macOS
bpo-42119 [https://bugs.python.org/issue?@action=redirect&bpo=42119]: Fix check for macOS SDK paths when building Python. Narrow search to match contents of SDKs, namely only files in
SystemLibrary
,SystemIOSSupport
, and/usr
other thanusrlocal
. Previously, anything under/System
was assumed to be in an SDK which causes problems with the new file system layout in 10.15+ where user file systems may appear to be mounted under/System
. Paths in/Library
were also incorrectly treated as SDK locations.bpo-43568 [https://bugs.python.org/issue?@action=redirect&bpo=43568]: Drop support for MACOSX_DEPLOYMENT_TARGET < 10.3
bpo-44009 [https://bugs.python.org/issue?@action=redirect&bpo=44009]: Provide "python3.x-intel64" executable to allow reliably forcing macOS universal2 framework builds to run under Rosetta 2 Intel64 emulation on Apple Silicon Macs. This can be useful for testing or when universal2 wheels are not yet available.
bpo-43851 [https://bugs.python.org/issue?@action=redirect&bpo=43851]: Build SQLite with
SQLITE_OMIT_AUTOINIT
on macOS. Patch by Erlend E. Aasland.bpo-43492 [https://bugs.python.org/issue?@action=redirect&bpo=43492]: Update macOS installer to use SQLite 3.35.4.
bpo-42235 [https://bugs.python.org/issue?@action=redirect&bpo=42235]:
Mac/BuildScript/build-installer.py
will now use "—enable-optimizations" and--with-lto
when building on macOS 10.15 or later.
IDLE
bpo-37903 [https://bugs.python.org/issue?@action=redirect&bpo=37903]: Add mouse actions to the shell sidebar. Left click and optional drag selects one or more lines, as with the editor line number sidebar. Right click after selecting raises a context menu with 'copy with prompts'. This zips together prompts from the sidebar with lines from the selected text.
bpo-43981 [https://bugs.python.org/issue?@action=redirect&bpo=43981]: Fix reference leak in test_sidebar and test_squeezer. Patches by Terry Jan Reedy and Pablo Galindo
bpo-37892 [https://bugs.python.org/issue?@action=redirect&bpo=37892]: Indent IDLE Shell input with spaces instead of tabs
bpo-43655 [https://bugs.python.org/issue?@action=redirect&bpo=43655]: IDLE dialog windows are now recognized as dialogs by window managers on macOS and X Window.
bpo-37903 [https://bugs.python.org/issue?@action=redirect&bpo=37903]: IDLE's shell now shows prompts in a separate sidebar.
C API
bpo-43916 [https://bugs.python.org/issue?@action=redirect&bpo=43916]: Add a new
Py_TPFLAGS_DISALLOW_INSTANTIATION
type flag to disallow creating type instances. Patch by Victor Stinner.bpo-43774 [https://bugs.python.org/issue?@action=redirect&bpo=43774]: Remove the now unused
PYMALLOC_DEBUG
macro. Debug hooks on memory allocators are now installed by default if Python is built in debug mode (ifPy_DEBUG
macro is defined). Moreover, they can now be used on Python build in release mode (ex: usingPYTHONMALLOC=debug
environment variable).bpo-43962 [https://bugs.python.org/issue?@action=redirect&bpo=43962]: PyInterpreterStateIDIncref() now calls PyInterpreterStateIDInitref() and always increments id_refcount. Previously, calling xxsubinterpreters.getcurrent() could create an id_refcount inconsistency when a _xxsubinterpreters.InterpreterID object was deallocated. Patch by Victor Stinner.
bpo-28254 [https://bugs.python.org/issue?@action=redirect&bpo=28254]: Add new C-API functions to control the state of the garbage collector:
PyGC_Enable()
,PyGC_Disable()
,PyGC_IsEnabled()
, corresponding to the functions in thegc
module.bpo-43908 [https://bugs.python.org/issue?@action=redirect&bpo=43908]: Introduce
Py_TPFLAGS_IMMUTABLETYPE
flag for immutable type objects, and modifyPyType_Ready()
to set it for static types. Patch by Erlend E. Aasland.bpo-43795 [https://bugs.python.org/issue?@action=redirect&bpo=43795]:
PyMem_Calloc()
is now available in the limited C API (Py_LIMITED_API
).bpo-43868 [https://bugs.python.org/issue?@action=redirect&bpo=43868]:
PyOS_ReadlineFunctionPointer()
is no longer exported by limited C API headers and bypython3.dll
on Windows. Like any function that takesFILE*
, it is not part of the stable ABI.bpo-43795 [https://bugs.python.org/issue?@action=redirect&bpo=43795]: Stable ABI and limited API definitions are generated from a central manifest ( PEP 652 [https://peps.python.org/pep-0652/]).
bpo-43753 [https://bugs.python.org/issue?@action=redirect&bpo=43753]: Add the
Py_Is(x, y)
function to test if the x object is the y object, the same asx is y
in Python. Add also thePy_IsNone()
,Py_IsTrue()
,Py_IsFalse()
functions to test if an object is, respectively, theNone
singleton, theTrue
singleton or theFalse
singleton. Patch by Victor Stinner.
Python 3.10.0 alpha 7
发布日期: 2021-04-05
安全性
bpo-42988 [https://bugs.python.org/issue?@action=redirect&bpo=42988]: CVE 2021-3426 [https://www.cve.org/CVERecord?id=CVE-2021-3426]: Remove the
getfile
feature of thepydoc
module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer.bpo-43285 [https://bugs.python.org/issue?@action=redirect&bpo=43285]:
ftplib
no longer trusts the IP address value returned from the server in response to the PASV command by default. This prevents a malicious FTP server from using the response to probe IPv4 address and port combinations on the client network.
Code that requires the former vulnerable behavior may set a trust_server_pasv_ipv4_address
attribute on their ftplib.FTP
instances to True
to re-enable it.
- bpo-43439 [https://bugs.python.org/issue?@action=redirect&bpo=43439]: Add audit hooks for
gc.get_objects()
,gc.get_referrers()
andgc.get_referents()
. Patch by Pablo Galindo.
核心与内置函数
bpo-27129 [https://bugs.python.org/issue?@action=redirect&bpo=27129]: Update CPython bytecode magic number.
bpo-43672 [https://bugs.python.org/issue?@action=redirect&bpo=43672]: Raise ImportWarning when calling find_loader().
bpo-43660 [https://bugs.python.org/issue?@action=redirect&bpo=43660]: Fix crash that happens when replacing
sys.stderr
with a callable that can remove the object while an exception is being printed. Patch by Pablo Galindo.bpo-27129 [https://bugs.python.org/issue?@action=redirect&bpo=27129]: The bytecode interpreter uses instruction, rather byte, offsets internally. This reduces the number of EXTENDED_ARG instructions needed and streamlines instruction dispatch a bit.
bpo-40645 [https://bugs.python.org/issue?@action=redirect&bpo=40645]: Fix reference leak in the
_hashopenssl
extension. Patch by Pablo Galindo.bpo-42134 [https://bugs.python.org/issue?@action=redirect&bpo=42134]: Calls to find_module() by the import system now raise ImportWarning.
bpo-41064 [https://bugs.python.org/issue?@action=redirect&bpo=41064]: Improve the syntax error for invalid usage of double starred elements ('**') in fstrings. Patch by Pablo Galindo.
bpo-43575 [https://bugs.python.org/issue?@action=redirect&bpo=43575]: Speed up calls to
map()
by using the PEP 590 [https://peps.python.org/pep-0590/]vectorcall
calling convention. Patch by Donghee Na.bpo-42137 [https://bugs.python.org/issue?@action=redirect&bpo=42137]: The import system now prefers using
__spec__
forModuleType._repr_
overmodule_repr()
.bpo-43452 [https://bugs.python.org/issue?@action=redirect&bpo=43452]: Added microoptimizations to
PyTypeLookup()
to improve cache lookup performance in the common case of cache hits.bpo-43555 [https://bugs.python.org/issue?@action=redirect&bpo=43555]: Report the column offset for
SyntaxError
for invalid line continuation characters. Patch by Pablo Galindo.bpo-43517 [https://bugs.python.org/issue?@action=redirect&bpo=43517]: Fix misdetection of circular imports when using
from pkg.mod import attr
, which caused false positives in nontrivial multithreaded code.bpo-43497 [https://bugs.python.org/issue?@action=redirect&bpo=43497]: Emit SyntaxWarnings for assertions with tuple constants, this is a regression introduced in python3.7
bpo-39316 [https://bugs.python.org/issue?@action=redirect&bpo=39316]: Tracing now has correct line numbers for attribute accesses when the attribute is on a different line from the object. Improves debugging and profiling for multiline method chains.
bpo-35883 [https://bugs.python.org/issue?@action=redirect&bpo=35883]: Python no longer fails at startup with a fatal error if a command line argument contains an invalid Unicode character. The
Py_DecodeLocale()
function now escapes byte sequences which would be decoded as Unicode characters outside the [U+0000; U+10ffff] range.bpo-43410 [https://bugs.python.org/issue?@action=redirect&bpo=43410]: Fix a bug that was causing the parser to crash when emitting syntax errors when reading input from stdin. Patch by Pablo Galindo
bpo-43406 [https://bugs.python.org/issue?@action=redirect&bpo=43406]: Fix a possible race condition where
PyErr_CheckSignals
tries to execute a non-Python signal handler.bpo-42128 [https://bugs.python.org/issue?@action=redirect&bpo=42128]: Add
__match_args__
to struct sequence objects. Patch by Pablo Galindo.bpo-43390 [https://bugs.python.org/issue?@action=redirect&bpo=43390]: CPython now sets the
SA_ONSTACK
flag inPyOS_setsig
for the VM's default signal handlers. This is friendlier to other in-process code that an extension module or embedding use could pull in (such as Golang's cgo) where tiny thread stacks are the norm andsigaltstack()
has been used to provide for signal handlers. This is a no-op change for the vast majority of processes that don't use sigaltstack.bpo-43287 [https://bugs.python.org/issue?@action=redirect&bpo=43287]: Speed up calls to
filter()
by using the PEP 590 [https://peps.python.org/pep-0590/]vectorcall
calling convention. Patch by Donghee Na.bpo-37448 [https://bugs.python.org/issue?@action=redirect&bpo=37448]: Add a radix tree based memory map to track in-use obmalloc arenas. Use to replace the old implementation of address_in_range(). The radix tree approach makes it easy to increase pool sizes beyond the OS page size. Boosting the pool and arena size allows obmalloc to handle a significantly higher percentage of requests from its ultra-fast paths.
It also has the advantage of eliminating the memory unsanitary behavior of the previous address_in_range(). The old address_in_range() was marked with the annotations PyNO_SANITIZE_ADDRESS, PyNO_SANITIZE_THREAD, and PyNO_SANITIZE_MEMORY. Those annotations are no longer needed.
To disable the radix tree map, set a preprocessor flag as follows: -DWITH_PYMALLOC_RADIX_TREE=0
.
Co-authored-by: Tim Peters <tim.peters@gmail.com>
- bpo-29988 [https://bugs.python.org/issue?@action=redirect&bpo=29988]: Only handle asynchronous exceptions and requests to drop the GIL when returning from a call or on the back edges of loops. Makes sure that
__exit__()
is always called in with statements, even for interrupts.
库
bpo-43720 [https://bugs.python.org/issue?@action=redirect&bpo=43720]: Document various stdlib deprecations in imp, pkgutil, and importlib.util for removal in Python 3.12.
bpo-43433 [https://bugs.python.org/issue?@action=redirect&bpo=43433]:
xmlrpc.client.ServerProxy
no longer ignores query and fragment in the URL of the server.bpo-31956 [https://bugs.python.org/issue?@action=redirect&bpo=31956]: The
index()
method ofarray.array
now has optional start and stop parameters.bpo-40066 [https://bugs.python.org/issue?@action=redirect&bpo=40066]: Enum: adjust
repr()
to show only enum and member name (not value, nor angle brackets) andstr()
to show only member name. Update and improve documentation to match.bpo-42136 [https://bugs.python.org/issue?@action=redirect&bpo=42136]: Deprecate all module_repr() methods found in importlib as their use is being phased out by Python 3.12.
bpo-35930 [https://bugs.python.org/issue?@action=redirect&bpo=35930]: Raising an exception raised in a "future" instance will create reference cycles.
bpo-41369 [https://bugs.python.org/issue?@action=redirect&bpo=41369]: Finish updating the vendored libmpdec to version 2.5.1. Patch by Stefan Krah.
bpo-43422 [https://bugs.python.org/issue?@action=redirect&bpo=43422]: Revert the _decimal C API which was added in bpo-41324 [https://bugs.python.org/issue?@action=redirect&bpo=41324].
bpo-43577 [https://bugs.python.org/issue?@action=redirect&bpo=43577]: Fix deadlock when using
ssl.SSLContext
debug callback withssl.SSLContext.sni_callback()
.bpo-43571 [https://bugs.python.org/issue?@action=redirect&bpo=43571]: It's now possible to create MPTCP sockets with IPPROTO_MPTCP
bpo-43542 [https://bugs.python.org/issue?@action=redirect&bpo=43542]:
image/heic
andimage/heif
were added tomimetypes
.bpo-40645 [https://bugs.python.org/issue?@action=redirect&bpo=40645]: The
hmac
module now uses OpenSSL's HMAC implementation when digestmod argument is a hash name or builtin hash function.bpo-43510 [https://bugs.python.org/issue?@action=redirect&bpo=43510]: Implement PEP 597 [https://peps.python.org/pep-0597/]: Add
EncodingWarning
warning,-X warn_default_encoding
option,PYTHONWARNDEFAULTENCODING
environment variable andencoding="locale"
argument value.bpo-43521 [https://bugs.python.org/issue?@action=redirect&bpo=43521]:
ast.unparse
can now render NaNs and empty sets.bpo-42914 [https://bugs.python.org/issue?@action=redirect&bpo=42914]:
pprint.pprint()
gains a new booleanunderscore_numbers
optional argument to emit integers with thousands separated by an underscore character for improved readability (for example1_000_000
instead of1000000
).bpo-41361 [https://bugs.python.org/issue?@action=redirect&bpo=41361]:
rotate()
calls are now slightly faster due to faster argument parsing.bpo-43423 [https://bugs.python.org/issue?@action=redirect&bpo=43423]:
subprocess.communicate()
no longer raises an IndexError when there is an empty stdout or stderr IO buffer during a timeout on Windows.bpo-27820 [https://bugs.python.org/issue?@action=redirect&bpo=27820]: Fixed longstanding bug of smtplib.SMTP where doing AUTH LOGIN with initial_response_ok=False will fail.
The cause is that SMTP.auth_login always returns a password if provided with a challenge string, thus non-compliant with the standard for AUTH LOGIN.
Also fixes bug with the test for smtpd.
bpo-43445 [https://bugs.python.org/issue?@action=redirect&bpo=43445]: Add frozen modules to
sys.stdlib_module_names
. For example, add"frozenimportlib"
and"frozenimportlib_external"
names.bpo-43245 [https://bugs.python.org/issue?@action=redirect&bpo=43245]: Add keyword arguments support to
ChainMap.new_child()
.bpo-29982 [https://bugs.python.org/issue?@action=redirect&bpo=29982]: Add optional parameter ignore_cleanup_errors to
tempfile.TemporaryDirectory()
and allow multiplecleanup()
attempts. Contributed by C.A.M. Gerlach.bpo-43428 [https://bugs.python.org/issue?@action=redirect&bpo=43428]: Include changes from importlib_metadata 3.7 [https://importlib-metadata.readthedocs.io/en/latest/history.html#v3-7-0]: Performance enhancements to distribution discovery.
entry_points
only returns unique distributions.
Introduces new EntryPoints
object for containing a set of entry points with convenience methods for selecting entry points by group or name. entry_points
now returns this object if selection parameters are supplied but continues to return a dict object for compatibility. Users are encouraged to rely on the selection interface. The dict object result is likely to be deprecated in the future.
Added packages_distributions function to return a mapping of packages to the distributions that provide them.
bpo-43332 [https://bugs.python.org/issue?@action=redirect&bpo=43332]: Improves the networking efficiency of
http.client
when using a proxy viaset_tunnel()
. Fewer small send calls are made during connection setup.bpo-43420 [https://bugs.python.org/issue?@action=redirect&bpo=43420]: Improve performance of
fractions.Fraction
arithmetics for large components. Contributed by Sergey B. Kirpichev.bpo-43356 [https://bugs.python.org/issue?@action=redirect&bpo=43356]: Allow passing a signal number to
thread.interruptmain()
.bpo-43399 [https://bugs.python.org/issue?@action=redirect&bpo=43399]: Fix
ElementTree.extend
not working on iterators when using the Python implementationbpo-43369 [https://bugs.python.org/issue?@action=redirect&bpo=43369]: Improve
sqlite3
error handling: Ifsqlite3_column_text()
andsqlite3_column_blob()
setSQLITE_NOMEM
,MemoryError
is now raised. Patch by Erlend E. Aasland.bpo-43368 [https://bugs.python.org/issue?@action=redirect&bpo=43368]: Fix a regression introduced in PR 24562, where an empty bytestring was fetched as
None
instead ofb''
insqlite3
. Patch by Mariusz Felisiak.bpo-41282 [https://bugs.python.org/issue?@action=redirect&bpo=41282]: Fixed stacklevel of
DeprecationWarning
emitted fromimport distutils
.bpo-42129 [https://bugs.python.org/issue?@action=redirect&bpo=42129]:
importlib.resources
now honors namespace packages, merging resources from each location in the namespace as introduced inimportlib_resources
3.2 and including incidental changes through 5.0.3.bpo-43295 [https://bugs.python.org/issue?@action=redirect&bpo=43295]:
datetime.datetime.strptime()
now raisesValueError
instead ofIndexError
when matching'z'
with the%z
format specifier.bpo-43125 [https://bugs.python.org/issue?@action=redirect&bpo=43125]: Return empty string if base64mime.body_encode receive empty bytes
bpo-43084 [https://bugs.python.org/issue?@action=redirect&bpo=43084]:
curses.window.enclose()
returns nowTrue
orFalse
(as was documented) instead of1
or0
.bpo-42994 [https://bugs.python.org/issue?@action=redirect&bpo=42994]: Add MIME types for opus, AAC, 3gpp and 3gpp2
bpo-14678 [https://bugs.python.org/issue?@action=redirect&bpo=14678]: Add an invalidate_caches() method to the zipimport.zipimporter class to support importlib.invalidate_caches(). Patch by Desmond Cheong.
bpo-42782 [https://bugs.python.org/issue?@action=redirect&bpo=42782]: Fail fast in
shutil.move()
to avoid creating destination directories on failure.bpo-40066 [https://bugs.python.org/issue?@action=redirect&bpo=40066]: Enum's
repr()
andstr()
have changed:repr()
is now EnumClass.MemberName andstr()
is MemberName. Additionally, stdlib Enum's whose contents are available as module attributes, such asRegexFlag.IGNORECASE
, have theirrepr()
as module.name, e.g.re.IGNORECASE
.bpo-26053 [https://bugs.python.org/issue?@action=redirect&bpo=26053]: Fixed bug where the
pdb
interactive run command echoed the args from the shell command line, even if those have been overridden at the pdb prompt.bpo-24160 [https://bugs.python.org/issue?@action=redirect&bpo=24160]: Fixed bug where breakpoints did not persist across multiple debugger sessions in
pdb
's interactive mode.bpo-40701 [https://bugs.python.org/issue?@action=redirect&bpo=40701]: When the
tempfile.tempdir
global variable is set to a value of type bytes, it is now handled consistently. Previously exceptions could be raised from some tempfile APIs when the directory did not already exist in this situation. Also ensures that thetempfile.gettempdir()
andtempfile.gettempdirb()
functions always returnstr
andbytes
respectively.bpo-39342 [https://bugs.python.org/issue?@action=redirect&bpo=39342]: Expose
X509_V_FLAG_ALLOW_PROXY_CERTS
asVERIFY_ALLOW_PROXY_CERTS
to allow proxy certificate validation as explained in https://docs.openssl.org/1.1.1/man7/proxy-certificates/.bpo-31861 [https://bugs.python.org/issue?@action=redirect&bpo=31861]: Add builtins.aiter and builtins.anext. Patch by Joshua Bronson (@jab), Daniel Pope (@lordmauve), and Justin Wang (@justin39).
文档
bpo-43199 [https://bugs.python.org/issue?@action=redirect&bpo=43199]: Answer "Why is there no goto?" in the Design and History FAQ.
bpo-43407 [https://bugs.python.org/issue?@action=redirect&bpo=43407]: Clarified that a result from
time.monotonic()
,time.perf_counter()
,time.process_time()
, ortime.thread_time()
can be compared with the result from any following call to the same function - not just the next immediate call.bpo-43354 [https://bugs.python.org/issue?@action=redirect&bpo=43354]: Fix type documentation for
Fault.faultCode
; the type has to beint
instead ofstr
.bpo-41933 [https://bugs.python.org/issue?@action=redirect&bpo=41933]: Clarified wording of s * n in the Common Sequence Operations
测试
bpo-37945 [https://bugs.python.org/issue?@action=redirect&bpo=37945]: Fix test_getsetlocale_issue1813() of test_locale: skip the test if
setlocale()
fails. Patch by Victor Stinner.bpo-41561 [https://bugs.python.org/issue?@action=redirect&bpo=41561]: Add workaround for Ubuntu's custom OpenSSL security level policy.
构建
bpo-43179 [https://bugs.python.org/issue?@action=redirect&bpo=43179]: Introduce and correctly use ALIGNOF_X in place of SIZEOF_X for alignment-related code in optimized string routines. Patch by Jessica Clarke.
bpo-43631 [https://bugs.python.org/issue?@action=redirect&bpo=43631]: Update macOS, Windows, and CI to OpenSSL 1.1.1k.
bpo-43617 [https://bugs.python.org/issue?@action=redirect&bpo=43617]: Improve configure.ac: Check for presence of autoconf-archive package and remove our copies of M4 macros.
bpo-43466 [https://bugs.python.org/issue?@action=redirect&bpo=43466]: The
configure
script now supports--with-openssl-rpath
option.bpo-43372 [https://bugs.python.org/issue?@action=redirect&bpo=43372]: Use
freezeimportlib
to generate code for the__hello__
module. This approach ensures the code matches the interpreter version. Previously, PYTHON_FOR_REGEN was used to generate the code, which might be wrong. The marshal format for code objects has changed with bpo-42246 [https://bugs.python.org/issue?@action=redirect&bpo=42246], commit 877df851. Update the code and the expected code sizes in ctypes test_frozentable.
Windows
- bpo-43440 [https://bugs.python.org/issue?@action=redirect&bpo=43440]: Build
sqlite3
with theR*Tree
module enabled. Patch by Erlend E. Aasland.
IDLE
- bpo-42225 [https://bugs.python.org/issue?@action=redirect&bpo=42225]: Document that IDLE can fail on Unix either from misconfigured IP masquerade rules or failure displaying complex colored (nonascii) characters.
C API
- bpo-43688 [https://bugs.python.org/issue?@action=redirect&bpo=43688]: The limited C API is now supported if Python is built in debug mode (if the
Py_DEBUG
macro is defined). In the limited C API, thePy_INCREF()
andPy_DECREF()
functions are now implemented as opaque function calls, rather than accessing directly thePyObject.ob_refcnt
member, if Python is built in debug mode and thePy_LIMITED_API
macro targets Python 3.10 or newer. It became possible to support the limited C API in debug mode because thePyObject
structure is the same in release and debug mode since Python 3.8 (see bpo-36465 [https://bugs.python.org/issue?@action=redirect&bpo=36465]).
The limited C API is still not supported in the --with-trace-refs
special build (Py_TRACE_REFS
macro).
Patch by Victor Stinner.
bpo-43244 [https://bugs.python.org/issue?@action=redirect&bpo=43244]: Remove the
pyarena.h
header file with functions:PyArena_New()
PyArena_Free()
PyArena_Malloc()
PyArena_AddPyObject()
These functions were undocumented, excluded from the limited C API, and were only used internally by the compiler. Patch by Victor Stinner.
bpo-43244 [https://bugs.python.org/issue?@action=redirect&bpo=43244]: Remove the compiler and parser functions using
struct _mod
type, because the public AST C API was removed:PyAST_Compile()
PyAST_CompileEx()
PyAST_CompileObject()
PyFuture_FromAST()
PyFuture_FromASTObject()
PyParser_ASTFromFile()
PyParser_ASTFromFileObject()
PyParser_ASTFromFilename()
PyParser_ASTFromString()
PyParser_ASTFromStringObject()
These functions were undocumented and excluded from the limited C API. Patch by Victor Stinner.
bpo-43244 [https://bugs.python.org/issue?@action=redirect&bpo=43244]: Remove
ast.h
,asdl.h
, andPython-ast.h
header files. These functions were undocumented and excluded from the limited C API. Most names defined by these header files were not prefixed byPy
and so could create names conflicts. For example,Python-ast.h
defined aYield
macro which was conflict with theYield
name used by the Windows
header. Use the Pythonast
module instead. Patch by Victor Stinner.bpo-43541 [https://bugs.python.org/issue?@action=redirect&bpo=43541]: Fix a
PyEval_EvalCodeEx()
regression: fix reference counting on builtins. Patch by Victor Stinner.bpo-43244 [https://bugs.python.org/issue?@action=redirect&bpo=43244]: Remove the
symtable.h
header file and the undocumented functions:PyST_GetScope()
PySymtable_Build()
PySymtable_BuildObject()
PySymtable_Free()
Py_SymtableString()
Py_SymtableStringObject()
Py_SymtableString()
函数误为稳定版 ABI 却无法使用,因为 symtable.h
头文件不属于受限 C API。
The Python symtable
module remains available and is unchanged.
Patch by Victor Stinner.
- bpo-43244 [https://bugs.python.org/issue?@action=redirect&bpo=43244]: Remove the
PyAST_Validate()
function. It is no longer possible to build a AST object (mod_ty
type) with the public C API. The function was already excluded from the limited C API ( PEP 384 [https://peps.python.org/pep-0384/]). Patch by Victor Stinner.
Python 3.10.0 alpha 6
发布日期: 2021-03-01