工具/示例
bpo-40385 [https://bugs.python.org/issue?@action=redirect&bpo=40385]: Removed the checkpyc.py tool. Please see compileall without force mode as a potential alternative.
bpo-40179 [https://bugs.python.org/issue?@action=redirect&bpo=40179]: Fixed translation of
#elif
in Argument Clinic.bpo-40094 [https://bugs.python.org/issue?@action=redirect&bpo=40094]: Fix
which.py
script exit code: it now usesos.waitstatus_to_exitcode()
to convertos.system()
exit status into an exit code.
C API
bpo-40241 [https://bugs.python.org/issue?@action=redirect&bpo=40241]: Move the
PyGC_Head
structure to the internal C API.bpo-40170 [https://bugs.python.org/issue?@action=redirect&bpo=40170]: Convert
PyObject_IS_GC()
macro to a function to hide implementation details.bpo-40241 [https://bugs.python.org/issue?@action=redirect&bpo=40241]: Add the functions
PyObject_GC_IsTracked()
andPyObject_GC_IsFinalized()
to the public API to allow to query if Python objects are being currently tracked or have been already finalized by the garbage collector respectively. Patch by Pablo Galindo.bpo-40170 [https://bugs.python.org/issue?@action=redirect&bpo=40170]: The
PyObject_NEW()
macro becomes an alias to thePyObject_New()
macro, and thePyObject_NEW_VAR()
macro becomes an alias to thePyObject_NewVar()
macro, to hide implementation details. They no longer access directly thePyTypeObject.tp_basicsize
member.bpo-40170 [https://bugs.python.org/issue?@action=redirect&bpo=40170]:
PyType_HasFeature()
now always callsPyType_GetFlags()
to hide implementation details. Previously, it accessed directly thePyTypeObject.tp_flags
member when the limited C API was not used.bpo-40170 [https://bugs.python.org/issue?@action=redirect&bpo=40170]: Convert the
PyObject_GET_WEAKREFS_LISTPTR()
macro to a function to hide implementation details: the macro accessed directly to thePyTypeObject.tp_weaklistoffset
member.bpo-40170 [https://bugs.python.org/issue?@action=redirect&bpo=40170]: Convert
PyObject_CheckBuffer()
macro to a function to hide implementation details: the macro accessed directly thePyTypeObject.tpasbuffer
member.bpo-40170 [https://bugs.python.org/issue?@action=redirect&bpo=40170]: Always declare
PyIndex_Check()
as an opaque function to hide implementation details: removePyIndex_Check()
macro. The macro accessed directly thePyTypeObject.tpasnumber
member.bpo-39947 [https://bugs.python.org/issue?@action=redirect&bpo=39947]: Add
PyThreadState_GetID()
function: get the unique identifier of a Python thread state.
Python 3.9.0 alpha 5
发布日期: 2020-03-23
安全性
- bpo-38576 [https://bugs.python.org/issue?@action=redirect&bpo=38576]: Disallow control characters in hostnames in http.client, addressing CVE 2019-18348 [https://www.cve.org/CVERecord?id=CVE-2019-18348]. Such potentially malicious header injection URLs now cause a InvalidURL to be raised.
核心与内置函数
- bpo-40010 [https://bugs.python.org/issue?@action=redirect&bpo=40010]: Optimize pending calls in multithreaded applications. If a thread different than the main thread schedules a pending call (
Py_AddPendingCall()
), the bytecode evaluation loop is no longer interrupted at each bytecode instruction to check for pending calls which cannot be executed. Only the main thread can execute pending calls.
Previously, the bytecode evaluation loop was interrupted at each instruction until the main thread executes pending calls.
bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _weakref extension module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _collections module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-40010 [https://bugs.python.org/issue?@action=redirect&bpo=40010]: Optimize signal handling in multithreaded applications. If a thread different than the main thread gets a signal, the bytecode evaluation loop is no longer interrupted at each bytecode instruction to check for pending signals which cannot be handled. Only the main thread of the main interpreter can handle signals.
Previously, the bytecode evaluation loop was interrupted at each instruction until the main thread handles signals.
bpo-39984 [https://bugs.python.org/issue?@action=redirect&bpo=39984]: If
Py_AddPendingCall()
is called in a subinterpreter, the function is now scheduled to be called from the subinterpreter, rather than being called from the main interpreter. Each subinterpreter now has its own list of scheduled calls.bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _heapq module to multiphase initialization.
bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port itertools module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-37207 [https://bugs.python.org/issue?@action=redirect&bpo=37207]: Speed up calls to
frozenset()
by using the PEP 590 [https://peps.python.org/pep-0590/]vectorcall
calling convention. Patch by Donghee Na.bpo-39984 [https://bugs.python.org/issue?@action=redirect&bpo=39984]: subinterpreters: Move
_PyRuntimeState.ceval.tracing_possible
toPyInterpreterState.ceval.tracing_possible
: each interpreter now has its own variable.bpo-37207 [https://bugs.python.org/issue?@action=redirect&bpo=37207]: Speed up calls to
set()
by using the PEP 590 [https://peps.python.org/pep-0590/]vectorcall
calling convention. Patch by Donghee Na.bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _statistics module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-39968 [https://bugs.python.org/issue?@action=redirect&bpo=39968]: Use inline function to replace extension modules' get_module_state macros.
bpo-39965 [https://bugs.python.org/issue?@action=redirect&bpo=39965]: Correctly raise
SyntaxError
if await is used inside non-async functions andPyCF_ALLOW_TOP_LEVEL_AWAIT
is set (like in the asyncio REPL). Patch by Pablo Galindo.bpo-39562 [https://bugs.python.org/issue?@action=redirect&bpo=39562]: Allow executing asynchronous comprehensions on the top level when the
PyCF_ALLOW_TOP_LEVEL_AWAIT
flag is given. Patch by Batuhan Taskaya.bpo-37207 [https://bugs.python.org/issue?@action=redirect&bpo=37207]: Speed up calls to
tuple()
by using the PEP 590 [https://peps.python.org/pep-0590/]vectorcall
calling convention. Patch by Donghee Na.bpo-38373 [https://bugs.python.org/issue?@action=redirect&bpo=38373]: Changed list overallocation strategy. It no longer overallocates if the new size is closer to overallocated size than to the old size and adds padding.
bpo-39926 [https://bugs.python.org/issue?@action=redirect&bpo=39926]: Update Unicode database to Unicode version 13.0.0.
bpo-19466 [https://bugs.python.org/issue?@action=redirect&bpo=19466]: Clear the frames of daemon threads earlier during the Python shutdown to call objects destructors. So "unclosed file" resource warnings are now emitted for daemon threads in a more reliable way.
bpo-38894 [https://bugs.python.org/issue?@action=redirect&bpo=38894]: Fix a bug that was causing incomplete results when calling
pathlib.Path.glob
in the presence of symlinks that point to files where the user does not have read access. Patch by Pablo Galindo and Matt Wozniski.bpo-39877 [https://bugs.python.org/issue?@action=redirect&bpo=39877]: Fix
PyEval_RestoreThread()
random crash at exit with daemon threads. It now accesses the_PyRuntime
variable directly instead of usingtstate->interp->runtime
, sincetstate
can be a dangling pointer afterPy_Finalize()
has been called. Moreover, the daemon thread now exits before trying to take the GIL.bpo-39871 [https://bugs.python.org/issue?@action=redirect&bpo=39871]: Fix a possible
SystemError
inmath.{atan2,copysign,remainder}()
when the first argument cannot be converted to afloat
. Patch by Zackery Spytz.bpo-39776 [https://bugs.python.org/issue?@action=redirect&bpo=39776]: Fix race condition where threads created by PyGILState_Ensure() could get a duplicate id.
This affects consumers of tstate->id like the contextvar caching machinery, which could return invalid cached objects under heavy thread load (observed in embedded scenarios).
bpo-39778 [https://bugs.python.org/issue?@action=redirect&bpo=39778]: Fixed a crash due to incorrect handling of weak references in
collections.OrderedDict
classes. Patch by Pablo Galindo.bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port audioop extension module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-39702 [https://bugs.python.org/issue?@action=redirect&bpo=39702]: Relax decorator grammar restrictions to allow any valid expression ( PEP 614 [https://peps.python.org/pep-0614/]).
bpo-38091 [https://bugs.python.org/issue?@action=redirect&bpo=38091]: Tweak import deadlock detection code to not deadlock itself.
bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _locale extension module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-39087 [https://bugs.python.org/issue?@action=redirect&bpo=39087]: Optimize
PyUnicode_AsUTF8()
andPyUnicode_AsUTF8AndSize()
slightly when they need to create internal UTF-8 cache.bpo-39520 [https://bugs.python.org/issue?@action=redirect&bpo=39520]: Fix unparsing of ext slices with no items (
foo[:,]
). Patch by Batuhan Taskaya.bpo-39220 [https://bugs.python.org/issue?@action=redirect&bpo=39220]: Do not optimize annotations if 'from future import annotations' is used. Patch by Pablo Galindo.
bpo-35712 [https://bugs.python.org/issue?@action=redirect&bpo=35712]: Using
NotImplemented
in a boolean context has been deprecated. Patch contributed by Josh Rosenberg.bpo-22490 [https://bugs.python.org/issue?@action=redirect&bpo=22490]: Don't leak environment variable
__PYVENV_LAUNCHER__
into the interpreter session on macOS.
库
bpo-39830 [https://bugs.python.org/issue?@action=redirect&bpo=39830]: Add
zipfile.Path
to__all__
in thezipfile
module.bpo-40000 [https://bugs.python.org/issue?@action=redirect&bpo=40000]: Improved error messages for validation of
ast.Constant
nodes. Patch by Batuhan Taskaya.bpo-39999 [https://bugs.python.org/issue?@action=redirect&bpo=39999]:
__module__
of the AST node classes is now set to "ast" instead of "_ast". Added docstrings for dummy AST node classes and deprecated attributes.bpo-39991 [https://bugs.python.org/issue?@action=redirect&bpo=39991]:
uuid.getnode()
now skips IPv6 addresses with the same string length than a MAC address (17 characters): only use MAC addresses.bpo-39988 [https://bugs.python.org/issue?@action=redirect&bpo=39988]: Deprecated
ast.AugLoad
andast.AugStore
node classes because they are no longer used.bpo-39656 [https://bugs.python.org/issue?@action=redirect&bpo=39656]: Ensure
bin/python3.#
is always present in virtual environments on POSIX platforms - by Anthony Sottile.bpo-39969 [https://bugs.python.org/issue?@action=redirect&bpo=39969]: Deprecated
ast.Param
node class because it's no longer used. Patch by Batuhan Taskaya.bpo-39360 [https://bugs.python.org/issue?@action=redirect&bpo=39360]: Ensure all workers exit when finalizing a
multiprocessing.Pool
implicitly via the module finalization handlers of multiprocessing. This fixes a deadlock situation that can be experienced when the Pool is not properly finalized via the context manager or a call tomultiprocessing.Pool.terminate
. Patch by Batuhan Taskaya and Pablo Galindo.bpo-35370 [https://bugs.python.org/issue?@action=redirect&bpo=35370]: sys.settrace(), sys.setprofile() and _lsprof.Profiler.enable() now properly report
PySys_Audit()
error if "sys.setprofile" or "sys.settrace" audit event is denied.bpo-39936 [https://bugs.python.org/issue?@action=redirect&bpo=39936]: AIX: Fix aixsupport module when the subprocess is not available, when building Python from scratch. It now uses new private _bootsubprocess module, rather than having two implementations depending if subprocess is available or not. So aixsupport.aix_platform() result is now the same if subprocess is available or not.
bpo-36144 [https://bugs.python.org/issue?@action=redirect&bpo=36144]:
collections.OrderedDict
now implements|
and|=
( PEP 584 [https://peps.python.org/pep-0584/]).bpo-39652 [https://bugs.python.org/issue?@action=redirect&bpo=39652]: The column name found in
sqlite3.Cursor.description
is now truncated on the first '[' only if the PARSE_COLNAMES option is set.bpo-39915 [https://bugs.python.org/issue?@action=redirect&bpo=39915]: Ensure
unittest.mock.AsyncMock.await_args_list
has call objects in the order of awaited arguments instead of usingunittest.mock.Mock.call_args
which has the last value of the call. Patch by Karthikeyan Singaravelan.bpo-36144 [https://bugs.python.org/issue?@action=redirect&bpo=36144]: Updated
os.environ
andos.environb
to support PEP 584 [https://peps.python.org/pep-0584/]'s merge (|
) and update (|=
) operators.bpo-38662 [https://bugs.python.org/issue?@action=redirect&bpo=38662]: The
ensurepip
module now invokespip
via therunpy
module. Hence it is no longer tightly coupled with the internal API of the bundledpip
version, allowing easier updates to a newerpip
version both internally and for distributors.bpo-38075 [https://bugs.python.org/issue?@action=redirect&bpo=38075]: Fix the
random.Random.seed()
method when abool
is passed as the seed.bpo-39916 [https://bugs.python.org/issue?@action=redirect&bpo=39916]: More reliable use of
os.scandir()
inPath.glob()
. It no longer emits a ResourceWarning when interrupted.bpo-39850 [https://bugs.python.org/issue?@action=redirect&bpo=39850]:
multiprocessing
now supports abstract socket addresses (if abstract sockets are supported in the running platform). When creating arbitrary addresses (like when default-constructingmultiprocessing.connection.Listener
objects) abstract sockets are preferred to avoid the case when the temporary-file-generated address is too large for an AF_UNIX socket address. Patch by Pablo Galindo.bpo-36287 [https://bugs.python.org/issue?@action=redirect&bpo=36287]:
ast.dump()
no longer outputs optional fields and attributes with default values. The default values for optional fields and attributes of AST nodes are now set as class attributes (e.g.Constant.kind
is set toNone
).bpo-39889 [https://bugs.python.org/issue?@action=redirect&bpo=39889]: Fixed
ast.unparse()
for extended slices containing a single element (e.g.a[i:j,]
). Remove redundant tuples when index with a tuple (e.g.a[i, j]
).bpo-39828 [https://bugs.python.org/issue?@action=redirect&bpo=39828]: Fix
json.tool
to catchBrokenPipeError
. Patch by Donghee Na.bpo-13487 [https://bugs.python.org/issue?@action=redirect&bpo=13487]: Avoid a possible "RuntimeError: dictionary changed size during iteration" from
inspect.getmodule()
when it tried to loop throughsys.modules
.bpo-39674 [https://bugs.python.org/issue?@action=redirect&bpo=39674]: Revert "bpo-37330 [https://bugs.python.org/issue?@action=redirect&bpo=37330]: open() no longer accept 'U' in file mode". The "U" mode of open() is kept in Python 3.9 to ease transition from Python 2.7, but will be removed in Python 3.10.
bpo-28577 [https://bugs.python.org/issue?@action=redirect&bpo=28577]: The hosts method on 32-bit prefix length IPv4Networks and 128-bit prefix IPv6Networks now returns a list containing the single Address instead of an empty list.
bpo-39826 [https://bugs.python.org/issue?@action=redirect&bpo=39826]: Add getConnection method to logging HTTPHandler to enable custom connections.
bpo-39763 [https://bugs.python.org/issue?@action=redirect&bpo=39763]: Reimplement
distutils.spawn.spawn
function with thesubprocess
module.bpo-39794 [https://bugs.python.org/issue?@action=redirect&bpo=39794]: Add —without-decimal-contextvar build option. This enables a thread-local rather than a coroutine local context.
bpo-36144 [https://bugs.python.org/issue?@action=redirect&bpo=36144]:
collections.defaultdict
now implements|
( PEP 584 [https://peps.python.org/pep-0584/]).bpo-39517 [https://bugs.python.org/issue?@action=redirect&bpo=39517]: Fix runpy.run_path() when using pathlike objects
bpo-39775 [https://bugs.python.org/issue?@action=redirect&bpo=39775]: Change
inspect.Signature.parameters
back tocollections.OrderedDict
. This was changed todict
in Python 3.9.0a4.bpo-39678 [https://bugs.python.org/issue?@action=redirect&bpo=39678]: Refactor queue_manager in
concurrent.futures.ProcessPoolExecutor
to make it easier to maintain.bpo-39764 [https://bugs.python.org/issue?@action=redirect&bpo=39764]: Fix AttributeError when calling get_stack on a PyAsyncGenObject Task
bpo-39769 [https://bugs.python.org/issue?@action=redirect&bpo=39769]: The
compileall.compile_dir()
function's ddir parameter and the compileall command line flag-d
no longer write the wrong pathname to the generated pyc file for submodules beneath the root of the directory tree being compiled. This fixes a regression introduced with Python 3.5.bpo-36144 [https://bugs.python.org/issue?@action=redirect&bpo=36144]:
types.MappingProxyType
objects now support the merge (|
) operator from PEP 584 [https://peps.python.org/pep-0584/].bpo-38691 [https://bugs.python.org/issue?@action=redirect&bpo=38691]: The
importlib
module now ignores thePYTHONCASEOK
environment variable when the-E
or-I
command line options are being used.bpo-39719 [https://bugs.python.org/issue?@action=redirect&bpo=39719]: Remove
tempfile.SpooledTemporaryFile.softspace()
as files no longer have thesoftspace
attribute in Python 3. Patch by Shantanu.bpo-39667 [https://bugs.python.org/issue?@action=redirect&bpo=39667]: Improve pathlib.Path compatibility on zipfile.Path and correct performance degradation as found in zipp 3.0.
bpo-39638 [https://bugs.python.org/issue?@action=redirect&bpo=39638]: Keep ASDL signatures in the docstrings for
AST
nodes. Patch by Batuhan Taskayabpo-39639 [https://bugs.python.org/issue?@action=redirect&bpo=39639]: Deprecated
ast.Suite
node class because it's no longer used. Patch by Batuhan Taskaya.bpo-39609 [https://bugs.python.org/issue?@action=redirect&bpo=39609]: Add thread_name_prefix to default asyncio executor
bpo-39548 [https://bugs.python.org/issue?@action=redirect&bpo=39548]: Fix handling of header in
urllib.request.AbstractDigestAuthHandler
when the optionalqop
parameter is not present.bpo-39509 [https://bugs.python.org/issue?@action=redirect&bpo=39509]: HTTP status codes
103 EARLY_HINTS
and425 TOO_EARLY
are added tohttp.HTTPStatus
. Patch by Donghee Na.bpo-39507 [https://bugs.python.org/issue?@action=redirect&bpo=39507]: Adding HTTP status 418 "I'm a Teapot" to HTTPStatus in http library. Patch by Ross Rhodes.
bpo-39495 [https://bugs.python.org/issue?@action=redirect&bpo=39495]: Remove default value from attrs parameter of
xml.etree.ElementTree.TreeBuilder.start()
for consistency between Python and C implementations.bpo-38971 [https://bugs.python.org/issue?@action=redirect&bpo=38971]: Open issue in the BPO indicated a desire to make the implementation of codecs.open() at parity with io.open(), which implements a try/except to assure file stream gets closed before an exception is raised.
bpo-38641 [https://bugs.python.org/issue?@action=redirect&bpo=38641]: Added starred expressions support to
return
andyield
statements forlib2to3
. Patch by Vlad Emelianov.bpo-37534 [https://bugs.python.org/issue?@action=redirect&bpo=37534]: When using minidom module to generate XML documents the ability to add Standalone Document Declaration is added. All the changes are made to generate a document in compliance with Extensible Markup Language (XML) 1.0 (Fifth Edition) W3C Recommendation (available here: https://www.w3.org/TR/xml/#sec-prolog-dtd).
bpo-34788 [https://bugs.python.org/issue?@action=redirect&bpo=34788]: Add support for scoped IPv6 addresses to
ipaddress
. Patch by Oleksandr Pavliuk.bpo-34822 [https://bugs.python.org/issue?@action=redirect&bpo=34822]: Simplified AST for subscription. Simple indices are now represented by their value, extended slices are represented as tuples.
ast
classesIndex
andExtSlice
are considered deprecated and will be removed in future Python versions. In the meantime,Index(value)
now returns avalue
itself,ExtSlice(slices)
returnsTuple(slices, Load())
.
文档
bpo-39868 [https://bugs.python.org/issue?@action=redirect&bpo=39868]: Updated the Language Reference for PEP 572 [https://peps.python.org/pep-0572/].
bpo-13790 [https://bugs.python.org/issue?@action=redirect&bpo=13790]: Change 'string' to 'specification' in format doc.
bpo-17422 [https://bugs.python.org/issue?@action=redirect&bpo=17422]: The language reference no longer restricts default class namespaces to dicts only.
bpo-39530 [https://bugs.python.org/issue?@action=redirect&bpo=39530]: Fix misleading documentation about mixed-type numeric comparisons.
bpo-39718 [https://bugs.python.org/issue?@action=redirect&bpo=39718]: Update
token
documentation to reflect additions in Python 3.8bpo-39677 [https://bugs.python.org/issue?@action=redirect&bpo=39677]: Changed operand name of MAKE_FUNCTION from argc to flags for module
dis
测试
bpo-40019 [https://bugs.python.org/issue?@action=redirect&bpo=40019]: test_gdb now skips tests if it detects that gdb failed to read debug information because the Python binary is optimized.
bpo-27807 [https://bugs.python.org/issue?@action=redirect&bpo=27807]:
test_site.test_startup_imports()
is now skipped if a path ofsys.path
contains a.pth
file.bpo-26067 [https://bugs.python.org/issue?@action=redirect&bpo=26067]: Do not fail test_shutil test_chown test when uid or gid of user cannot be resolved to a name.
bpo-39855 [https://bugs.python.org/issue?@action=redirect&bpo=39855]: test_subprocess.test_user() now skips the test on an user name if the user name doesn't exist. For example, skip the test if the user "nobody" doesn't exist on Linux.
构建
bpo-39761 [https://bugs.python.org/issue?@action=redirect&bpo=39761]: Fix build with DTrace but without additional DFLAGS.
bpo-39763 [https://bugs.python.org/issue?@action=redirect&bpo=39763]: setup.py now uses a basic implementation of the
subprocess
module if thesubprocess
module is not available: before required C extension modules are built.bpo-1294959 [https://bugs.python.org/issue?@action=redirect&bpo=1294959]: Add
--with-platlibdir
option to the configure script: name of the platform-specific library directory, stored in the newsys.platlibdir
attribute. It is used to build the path of platform-specific extension modules and the path of the standard library. It is equal to"lib"
on most platforms. On Fedora and SuSE, it is equal to"lib64"
on 64-bit platforms. Patch by Jan Matějek, Matěj Cepl, Charalampos Stratakis and Victor Stinner.
Windows
bpo-39930 [https://bugs.python.org/issue?@action=redirect&bpo=39930]: Ensures the required
vcruntime140.dll
is included in install packages.bpo-39847 [https://bugs.python.org/issue?@action=redirect&bpo=39847]: Avoid hang when computer is hibernated whilst waiting for a mutex (for lock-related objects from
threading
) around 49-day uptime.bpo-38597 [https://bugs.python.org/issue?@action=redirect&bpo=38597]:
distutils
will no longer statically linkvcruntime140.dll
when a redistributable version is unavailable. All future releases of CPython will include a copy of this DLL to ensure distributed extensions can continue to load.bpo-38380 [https://bugs.python.org/issue?@action=redirect&bpo=38380]: Update Windows builds to use SQLite 3.31.1
bpo-39789 [https://bugs.python.org/issue?@action=redirect&bpo=39789]: Update Windows release build machines to Visual Studio 2019 (MSVC 14.2).
bpo-34803 [https://bugs.python.org/issue?@action=redirect&bpo=34803]: Package for nuget.org now includes repository reference and bundled icon image.
macOS
- bpo-38380 [https://bugs.python.org/issue?@action=redirect&bpo=38380]: Update macOS builds to use SQLite 3.31.1
IDLE
bpo-27115 [https://bugs.python.org/issue?@action=redirect&bpo=27115]: For 'Go to Line', use a Query box subclass with IDLE standard behavior and improved error checking.
bpo-39885 [https://bugs.python.org/issue?@action=redirect&bpo=39885]: Since clicking to get an IDLE context menu moves the cursor, any text selection should be and now is cleared.
bpo-39852 [https://bugs.python.org/issue?@action=redirect&bpo=39852]: Edit "Go to line" now clears any selection, preventing accidental deletion. It also updates Ln and Col on the status bar.
bpo-39781 [https://bugs.python.org/issue?@action=redirect&bpo=39781]: Selecting code context lines no longer causes a jump.
工具/示例
bpo-36184 [https://bugs.python.org/issue?@action=redirect&bpo=36184]: Port python-gdb.py to FreeBSD. python-gdb.py now checks for "take_gil" function name to check if a frame tries to acquire the GIL, instead of checking for "pthread_cond_timedwait" which is specific to Linux and can be a different condition than the GIL.
bpo-38080 [https://bugs.python.org/issue?@action=redirect&bpo=38080]: Added support to fix
getproxies
in thelib2to3.fixes.fix_urllib
module. Patch by José Roberto Meza Cabrera.
C API
bpo-40024 [https://bugs.python.org/issue?@action=redirect&bpo=40024]: Add
PyModule_AddType()
helper function: add a type to a module. Patch by Donghee Na.bpo-39946 [https://bugs.python.org/issue?@action=redirect&bpo=39946]: Remove
_PyRuntime.getframe
hook and removePyThreadStateGetFrame
macro which was an alias to_PyRuntime.getframe
. They were only exposed by the internal C API. Remove alsoPyThreadFrameGetter
type.bpo-39947 [https://bugs.python.org/issue?@action=redirect&bpo=39947]: Add
PyThreadState_GetFrame()
function: get the current frame of a Python thread state.bpo-37207 [https://bugs.python.org/issue?@action=redirect&bpo=37207]: Add PyArgNoKwnames helper function. Patch by Donghee Na.
bpo-39947 [https://bugs.python.org/issue?@action=redirect&bpo=39947]: Add
PyThreadState_GetInterpreter()
: get the interpreter of a Python thread state.bpo-39947 [https://bugs.python.org/issue?@action=redirect&bpo=39947]: Add
PyInterpreterState_Get()
function to the limited C API.bpo-35370 [https://bugs.python.org/issue?@action=redirect&bpo=35370]: If
PySys_Audit()
fails inPyEval_SetProfile()
orPyEval_SetTrace()
, log the error as an unraisable exception.bpo-39947 [https://bugs.python.org/issue?@action=redirect&bpo=39947]: Move the static inline function flavor of Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() to the internal C API: they access PyThreadState attributes. The limited C API provides regular functions which hide implementation details.
bpo-39947 [https://bugs.python.org/issue?@action=redirect&bpo=39947]: Py_TRASHCAN_BEGIN_CONDITION and Py_TRASHCAN_END macro no longer access PyThreadState attributes, but call new private PyTrashbegin() and PyTrashend() functions which hide implementation details.
bpo-39884 [https://bugs.python.org/issue?@action=redirect&bpo=39884]:
PyDescr_NewMethod()
andPyCFunction_NewEx()
now include the method name in the SystemError "bad call flags" error message to ease debug.bpo-39877 [https://bugs.python.org/issue?@action=redirect&bpo=39877]: Deprecated
PyEval_InitThreads()
andPyEval_ThreadsInitialized()
. CallingPyEval_InitThreads()
now does nothing.bpo-38249 [https://bugs.python.org/issue?@action=redirect&bpo=38249]:
Py_UNREACHABLE
is now implemented with__builtin_unreachable()
and analogs in release mode.bpo-38643 [https://bugs.python.org/issue?@action=redirect&bpo=38643]:
PyNumber_ToBase()
now raises aSystemError
instead of crashing when called with invalid base.bpo-39882 [https://bugs.python.org/issue?@action=redirect&bpo=39882]: The
Py_FatalError()
function is replaced with a macro which logs automatically the name of the current function, unless thePy_LIMITED_API
macro is defined.bpo-39824 [https://bugs.python.org/issue?@action=redirect&bpo=39824]: Extension modules:
m_traverse
,m_clear
andm_free
functions ofPyModuleDef
are no longer called if the module state was requested but is not allocated yet. This is the case immediately after the module is created and before the module is executed (Py_mod_exec
function). More precisely, these functions are not called ifm_size
is greater than 0 and the module state (as returned byPyModule_GetState()
) isNULL
.
没有模块状态的扩展模块 (m_size <= 0
) 不会受到影响。
bpo-38913 [https://bugs.python.org/issue?@action=redirect&bpo=38913]: Fixed segfault in
Py_BuildValue()
called with a format containing "#" and undefined PY_SSIZE_T_CLEAN whwn an exception is set.bpo-38500 [https://bugs.python.org/issue?@action=redirect&bpo=38500]: Add a private API to get and set the frame evaluation function: add
PyInterpreterStateGetEvalFrameFunc()
andPyInterpreterStateSetEvalFrameFunc()
C functions. The_PyFrameEvalFunction
function type now takes a tstate parameter.
Python 3.9.0 alpha 4
发布日期: 2020-02-25
安全性
bpo-39184 [https://bugs.python.org/issue?@action=redirect&bpo=39184]: Add audit events to functions in
fcntl
,msvcrt
,os
,resource
,shutil
,signal
andsyslog
.bpo-39401 [https://bugs.python.org/issue?@action=redirect&bpo=39401]: Avoid unsafe DLL load at startup on Windows 7 and earlier.
bpo-39184 [https://bugs.python.org/issue?@action=redirect&bpo=39184]: Add audit events to command execution functions in os and pty modules.
核心与内置函数
bpo-39382 [https://bugs.python.org/issue?@action=redirect&bpo=39382]: Fix a use-after-free in the single inheritance path of
issubclass()
, when the__bases__
of an object has a single reference, and so does its first item. Patch by Yonatan Goldschmidt.bpo-39573 [https://bugs.python.org/issue?@action=redirect&bpo=39573]: Update clinic tool to use
Py_IS_TYPE()
. Patch by Donghee Na.bpo-39619 [https://bugs.python.org/issue?@action=redirect&bpo=39619]: Enable use of
os.chroot()
on HP-UX systems.bpo-39573 [https://bugs.python.org/issue?@action=redirect&bpo=39573]: Add
Py_IS_TYPE()
static inline function to check whether the object o type is type.bpo-39606 [https://bugs.python.org/issue?@action=redirect&bpo=39606]: Fix regression caused by fix for bpo-39386 [https://bugs.python.org/issue?@action=redirect&bpo=39386], that prevented calling
aclose
on an async generator that had already been closed or exhausted.bpo-39579 [https://bugs.python.org/issue?@action=redirect&bpo=39579]: Change the ending column offset of
Attribute
nodes constructed inast_for_dotted_name
to point at the end of the current node and not at the end of the lastNAME
node.bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _crypt extension module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _contextvars extension module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-39510 [https://bugs.python.org/issue?@action=redirect&bpo=39510]: Fix segfault in
readinto()
method on closed BufferedReader.bpo-39502 [https://bugs.python.org/issue?@action=redirect&bpo=39502]: Fix
time.localtime()
on 64-bit AIX to support years before 1902 and after 2038. Patch by M Felt.bpo-39492 [https://bugs.python.org/issue?@action=redirect&bpo=39492]: Fix a reference cycle in the C Pickler that was preventing the garbage collection of deleted, pickled objects.
bpo-39453 [https://bugs.python.org/issue?@action=redirect&bpo=39453]: Fixed a possible crash in
list.__contains__()
when a list is changed during comparing items. Patch by Donghee Na.bpo-39434 [https://bugs.python.org/issue?@action=redirect&bpo=39434]: floor division of float operation now has a better performance. Also the message of
ZeroDivisionError
for this operation is updated. Patch by Donghee Na.bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _codecs extension module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _bz2 extension module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _abc extension module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-39320 [https://bugs.python.org/issue?@action=redirect&bpo=39320]: Replace two complex bytecodes for building dicts with two simpler ones. The new bytecodes
DICT_MERGE
andDICT_UPDATE
have been added The old bytecodesBUILD_MAP_UNPACK
andBUILD_MAP_UNPACK_WITH_CALL
have been removed.bpo-39219 [https://bugs.python.org/issue?@action=redirect&bpo=39219]: Syntax errors raised in the tokenizer now always set correct "text" and "offset" attributes.
bpo-36051 [https://bugs.python.org/issue?@action=redirect&bpo=36051]: Drop the GIL during large
bytes.join
operations. Patch by Bruce Merry.bpo-38960 [https://bugs.python.org/issue?@action=redirect&bpo=38960]: Fix DTrace build issues on FreeBSD. Patch by David Carlier.
bpo-37207 [https://bugs.python.org/issue?@action=redirect&bpo=37207]: Speed up calls to
range()
by about 30%, by using the PEP 590vectorcall
calling convention. Patch by Mark Shannon.bpo-36144 [https://bugs.python.org/issue?@action=redirect&bpo=36144]:
dict
(andcollections.UserDict
) objects now support PEP 584's merge (|
) and update (|=
) operators. Patch by Brandt Bucher.bpo-32856 [https://bugs.python.org/issue?@action=redirect&bpo=32856]: Optimized the idiom for assignment a temporary variable in comprehensions. Now
for y in [expr]
in comprehensions is as fast as a simple assignmenty = expr
.
库
bpo-30566 [https://bugs.python.org/issue?@action=redirect&bpo=30566]: Fix
IndexError
when trying to decode an invalid string with punycode codec.bpo-39649 [https://bugs.python.org/issue?@action=redirect&bpo=39649]: Remove obsolete check for
__args__
inbdb.Bdb.format_stack_entry
.bpo-39648 [https://bugs.python.org/issue?@action=redirect&bpo=39648]: Expanded
math.gcd()
andmath.lcm()
to handle multiple arguments.bpo-39681 [https://bugs.python.org/issue?@action=redirect&bpo=39681]: Fix a regression where the C pickle module wouldn't allow unpickling from a file-like object that doesn't expose a readinto() method.
bpo-35950 [https://bugs.python.org/issue?@action=redirect&bpo=35950]: Raise
io.UnsupportedOperation
inio.BufferedReader.truncate()
when it is called on a readonlyio.BufferedReader
instance.bpo-39479 [https://bugs.python.org/issue?@action=redirect&bpo=39479]: Add
math.lcm()
function: least common multiple.bpo-39674 [https://bugs.python.org/issue?@action=redirect&bpo=39674]: Revert "Do not expose abstract collection classes in the collections module" change (bpo-25988 [https://bugs.python.org/issue?@action=redirect&bpo=25988]). Aliases to ABC like collections.Mapping are kept in Python 3.9 to ease transition from Python 2.7, but will be removed in Python 3.10.
bpo-39104 [https://bugs.python.org/issue?@action=redirect&bpo=39104]: Fix hanging ProcessPoolExcutor on
shutdown(wait=False)
when a task has failed pickling.bpo-39627 [https://bugs.python.org/issue?@action=redirect&bpo=39627]: Fixed TypedDict totality check for inherited keys.
bpo-39474 [https://bugs.python.org/issue?@action=redirect&bpo=39474]: Fixed starting position of AST for expressions like
(a)(b)
,(a)[b]
and(a).b
.bpo-21016 [https://bugs.python.org/issue?@action=redirect&bpo=21016]: The
pydoc
andtrace
modules now use thesysconfig
module to get the path to the Python standard library, to support uncommon installation path likeusrlib64/python3.9/
on Fedora. Patch by Jan Matějek.bpo-39590 [https://bugs.python.org/issue?@action=redirect&bpo=39590]: Collections.deque now holds strong references during deque.contains and deque.count, fixing crashes.
bpo-39586 [https://bugs.python.org/issue?@action=redirect&bpo=39586]: The distutils
bdist_msi
command is deprecated in Python 3.9, usebdist_wheel
(wheel packages) instead.bpo-39595 [https://bugs.python.org/issue?@action=redirect&bpo=39595]: Improved performance of zipfile.Path for files with a large number of entries. Also improved performance and fixed minor issue as published with importlib_metadata 1.5 [https://importlib-metadata.readthedocs.io/en/latest/history.html#v1-5-0].
bpo-39350 [https://bugs.python.org/issue?@action=redirect&bpo=39350]: Fix regression in
fractions.Fraction
if the numerator and/or the denominator is anint
subclass. Themath.gcd()
function is now used to normalize the numerator and denominator.math.gcd()
always return aint
type. Previously, the GCD type depended on numerator and denominator.bpo-39567 [https://bugs.python.org/issue?@action=redirect&bpo=39567]: Added audit for
os.walk()
,os.fwalk()
,pathlib.Path.glob()
andpathlib.Path.rglob()
.bpo-39559 [https://bugs.python.org/issue?@action=redirect&bpo=39559]: Remove unused, undocumented argument
getters
fromuuid.getnode()
bpo-38149 [https://bugs.python.org/issue?@action=redirect&bpo=38149]:
sys.audit()
is now called only once per call ofglob.glob()
andglob.iglob()
.bpo-39546 [https://bugs.python.org/issue?@action=redirect&bpo=39546]: Fix a regression in
ArgumentParser
whereallow_abbrev=False
was ignored for long options that used a prefix character other than "-".bpo-39450 [https://bugs.python.org/issue?@action=redirect&bpo=39450]: Striped whitespace from docstring before returning it from
unittest.case.shortDescription()
.bpo-12915 [https://bugs.python.org/issue?@action=redirect&bpo=12915]: A new function
resolve_name
has been added to thepkgutil
module. This resolves a string of the form'a.b.c.d'
or'a.b:c.d'
to an object. In the example,a.b
is a package/module andc.d
is an object within that package/module reached via recursive attribute access.bpo-39353 [https://bugs.python.org/issue?@action=redirect&bpo=39353]: The
binascii.crc_hqx()
function is no longer deprecated.bpo-39493 [https://bugs.python.org/issue?@action=redirect&bpo=39493]: Mark
typing.IO.closed
as a propertybpo-39491 [https://bugs.python.org/issue?@action=redirect&bpo=39491]: Add
typing.Annotated
andinclude_extras
parameter totyping.get_type_hints()
as part of PEP 593 [https://peps.python.org/pep-0593/]. Patch by Till Varoquaux, documentation by Till Varoquaux and Konstantin Kashin.bpo-39485 [https://bugs.python.org/issue?@action=redirect&bpo=39485]: Fix a bug in
unittest.mock.create_autospec()
that would complain about the wrong number of arguments for custom descriptors defined in an extension module returning functions.bpo-38932 [https://bugs.python.org/issue?@action=redirect&bpo=38932]: Mock fully resets child objects on reset_mock(). Patch by Vegard Stikbakke
bpo-39082 [https://bugs.python.org/issue?@action=redirect&bpo=39082]: Allow AsyncMock to correctly patch static/class methods
bpo-39432 [https://bugs.python.org/issue?@action=redirect&bpo=39432]: Implement PEP-489 algorithm for nonascii "PyInit_…" symbol names in distutils to make it export the correct init symbol also on Windows.
bpo-18819 [https://bugs.python.org/issue?@action=redirect&bpo=18819]: Omit
devmajor
anddevminor
fields for non-device files intarfile
archives, enabling bit-for-bit compatibility with GNUtar(1)
.bpo-39349 [https://bugs.python.org/issue?@action=redirect&bpo=39349]: Added a new cancel_futures parameter to
concurrent.futures.Executor.shutdown()
that cancels all pending futures which have not started running, instead of waiting for them to complete before shutting down the executor.bpo-39274 [https://bugs.python.org/issue?@action=redirect&bpo=39274]:
bool(fraction.Fraction)
now returns a boolean even if (numerator != 0) does not return a boolean (ex: numpy number).bpo-34793 [https://bugs.python.org/issue?@action=redirect&bpo=34793]: Remove support for
with (await asyncio.lock):
andwith (yield from asyncio.lock):
. The same is correct forasyncio.Condition
andasyncio.Semaphore
.bpo-25597 [https://bugs.python.org/issue?@action=redirect&bpo=25597]: Ensure, if
wraps
is supplied tounittest.mock.MagicMock
, it is used to calculate return values for the magic methods instead of using the default return values. Patch by Karthikeyan Singaravelan.bpo-36350 [https://bugs.python.org/issue?@action=redirect&bpo=36350]:
inspect.Signature.parameters
andinspect.BoundArguments.arguments
are now dicts instead of OrderedDicts. Patch contributed by Rémi Lapeyre.bpo-35727 [https://bugs.python.org/issue?@action=redirect&bpo=35727]: Fix sys.exit() and sys.exit(None) exit code propagation when used in multiprocessing.Process.
bpo-32173 [https://bugs.python.org/issue?@action=redirect&bpo=32173]: Add
lazycache
function to__all__
. Usedict.clear
to clear the cache. * Refactoringgetline
function andcheckcache
function.
文档
bpo-17422 [https://bugs.python.org/issue?@action=redirect&bpo=17422]: The language reference now specifies restrictions on class namespaces. Adapted from a patch by Ethan Furman.
bpo-39572 [https://bugs.python.org/issue?@action=redirect&bpo=39572]: Updated documentation of
total
flag ofTypedDict
.bpo-39654 [https://bugs.python.org/issue?@action=redirect&bpo=39654]: In pyclbr doc, update 'class' to 'module' where appropriate and add readmodule comment. Patch by Hakan Çelik.
bpo-39153 [https://bugs.python.org/issue?@action=redirect&bpo=39153]: Clarify refcounting semantics for the following functions: - PyObject_SetItem - PyMapping_SetItemString - PyDict_SetItem - PyDict_SetItemString
bpo-39392 [https://bugs.python.org/issue?@action=redirect&bpo=39392]: Explain that when filling with turtle, overlap regions may be left unfilled.
bpo-39369 [https://bugs.python.org/issue?@action=redirect&bpo=39369]: Update mmap readline method description. The fact that the readline method does update the file position should not be ignored since this might give the impression for the programmer that it doesn't update it.
bpo-9056 [https://bugs.python.org/issue?@action=redirect&bpo=9056]: Include subsection in TOC for PDF version of docs.
测试
bpo-38325 [https://bugs.python.org/issue?@action=redirect&bpo=38325]: Skip tests on non-BMP characters of test_winconsoleio.
bpo-39502 [https://bugs.python.org/issue?@action=redirect&bpo=39502]: Skip test_zipfile.test_add_file_after_2107() if
time.localtime()
fails withOverflowError
. It is the case on AIX 6.1 for example.
构建
- bpo-39489 [https://bugs.python.org/issue?@action=redirect&bpo=39489]: Remove
COUNT_ALLOCS
special build.
Windows
bpo-39553 [https://bugs.python.org/issue?@action=redirect&bpo=39553]: Delete unused code related to SxS manifests.
bpo-39439 [https://bugs.python.org/issue?@action=redirect&bpo=39439]: Honor the Python path when a virtualenv is active on Windows.
bpo-39393 [https://bugs.python.org/issue?@action=redirect&bpo=39393]: Improve the error message when attempting to load a DLL with unresolved dependencies.
bpo-38883 [https://bugs.python.org/issue?@action=redirect&bpo=38883]:
home()
andexpanduser()
on Windows now preferUSERPROFILE
and no longer useHOME
, which is not normally set for regular user accounts. This makes them again behave likeos.path.expanduser()
, which was changed to ignoreHOME
in 3.8, see bpo-36264 [https://bugs.python.org/issue?@action=redirect&bpo=36264].bpo-39185 [https://bugs.python.org/issue?@action=redirect&bpo=39185]: The build.bat script has additional options for very-quiet output (-q) and very-verbose output (-vv)
IDLE
bpo-39663 [https://bugs.python.org/issue?@action=redirect&bpo=39663]: Add tests for pyparse find_good_parse_start().
bpo-39600 [https://bugs.python.org/issue?@action=redirect&bpo=39600]: In the font configuration window, remove duplicated font names.
bpo-30780 [https://bugs.python.org/issue?@action=redirect&bpo=30780]: Add remaining configdialog tests for buttons and highlights and keys tabs.
bpo-39388 [https://bugs.python.org/issue?@action=redirect&bpo=39388]: IDLE Settings Cancel button now cancels pending changes
bpo-38792 [https://bugs.python.org/issue?@action=redirect&bpo=38792]: Close an IDLE shell calltip if a
KeyboardInterrupt
or shell restart occurs. Patch by Zackery Spytz.
C API
bpo-35081 [https://bugs.python.org/issue?@action=redirect&bpo=35081]: Move the
bytes_methods.h
header file to the internal C API aspycore_bytes_methods.h
: it only contains private symbols (prefixed by_Py
), except of thePyDoc_STRVAR_shared()
macro.bpo-35081 [https://bugs.python.org/issue?@action=redirect&bpo=35081]: Move the
dtoa.h
header file to the internal C API aspycore_dtoa.h
: it only contains private functions (prefixed by_Py
). Themath
andcmath
modules must now be compiled with thePy_BUILD_CORE
macro defined.bpo-39573 [https://bugs.python.org/issue?@action=redirect&bpo=39573]: Add
Py_SET_SIZE()
function to set the size of an object.bpo-39500 [https://bugs.python.org/issue?@action=redirect&bpo=39500]:
PyUnicode_IsIdentifier()
does not callPy_FatalError()
anymore if the string is not ready.bpo-39573 [https://bugs.python.org/issue?@action=redirect&bpo=39573]: Add
Py_SET_TYPE()
function to set the type of an object.bpo-39573 [https://bugs.python.org/issue?@action=redirect&bpo=39573]: Add a
Py_SET_REFCNT()
function to set the reference counter of an object.bpo-39542 [https://bugs.python.org/issue?@action=redirect&bpo=39542]: Convert
PyType_HasFeature()
,PyType_Check()
andPyType_CheckExact()
macros to static inline functions.bpo-39542 [https://bugs.python.org/issue?@action=redirect&bpo=39542]: In the limited C API,
PyObject_INIT()
andPyObject_INIT_VAR()
are now defined as aliases toPyObject_Init()
andPyObject_InitVar()
to make their implementation opaque. It avoids to leak implementation details in the limited C API. Exclude the following functions from the limited C API:PyNewReference()
,PyForgetReference()
,PyTraceMallocNewReference()
andPyGetRefTotal()
.bpo-39542 [https://bugs.python.org/issue?@action=redirect&bpo=39542]: Exclude trashcan mechanism from the limited C API: it requires access to PyTypeObject and PyThreadState structure fields, whereas these structures are opaque in the limited C API.
bpo-39511 [https://bugs.python.org/issue?@action=redirect&bpo=39511]: The
PyThreadState_Clear()
function now calls thePyThreadState.on_delete
callback. Previously, that happened inPyThreadState_Delete()
.bpo-38076 [https://bugs.python.org/issue?@action=redirect&bpo=38076]: Fix to clear the interpreter state only after clearing module globals to guarantee module state access from C Extensions during runtime destruction
bpo-39245 [https://bugs.python.org/issue?@action=redirect&bpo=39245]: The Vectorcall API (PEP 590) was made public, adding the functions
PyObject_Vectorcall
,PyObject_VectorcallMethod
,PyVectorcall_Function
,PyObject_CallOneArg
,PyObject_CallMethodNoArgs
,PyObject_CallMethodOneArg
,PyObject_FastCallDict
, and the flagPy_TPFLAGS_HAVE_VECTORCALL
.
Python 3.9.0 alpha 3
发布日期: 2020-01-24
核心与内置函数
bpo-39427 [https://bugs.python.org/issue?@action=redirect&bpo=39427]: Document all possibilities for the
-X
options in the command line help section. Patch by Pablo Galindo.bpo-39421 [https://bugs.python.org/issue?@action=redirect&bpo=39421]: Fix possible crashes when operating with the functions in the
heapq
module and custom comparison operators.bpo-39386 [https://bugs.python.org/issue?@action=redirect&bpo=39386]: Prevent double awaiting of async iterator.
bpo-17005 [https://bugs.python.org/issue?@action=redirect&bpo=17005]: Add
functools.TopologicalSorter
to thefunctools
module to offers functionality to perform topological sorting of graphs. Patch by Pablo Galindo, Tim Peters and Larry Hastings.bpo-39320 [https://bugs.python.org/issue?@action=redirect&bpo=39320]: Replace four complex bytecodes for building sequences with three simpler ones.
The following four bytecodes have been removed:
BUILD_LIST_UNPACK
BUILD_TUPLE_UNPACK
BUILD_SET_UNPACK
BUILD_TUPLE_UNPACK_WITH_CALL
The following three bytecodes have been added:
LIST_TO_TUPLE
LIST_EXTEND
SET_UPDATE
bpo-39336 [https://bugs.python.org/issue?@action=redirect&bpo=39336]: Import loaders which publish immutable module objects can now publish immutable packages in addition to individual modules.
bpo-39322 [https://bugs.python.org/issue?@action=redirect&bpo=39322]: Added a new function
gc.is_finalized()
to check if an object has been finalized by the garbage collector. Patch by Pablo Galindo.bpo-39048 [https://bugs.python.org/issue?@action=redirect&bpo=39048]: Improve the displayed error message when incorrect types are passed to
async with
statements by looking up the__aenter__()
special method before the__aexit__()
special method when entering an asynchronous context manager. Patch by Géry Ogam.bpo-39235 [https://bugs.python.org/issue?@action=redirect&bpo=39235]: Fix AST end location for lone generator expression in function call, e.g. f(i for i in a).
bpo-39209 [https://bugs.python.org/issue?@action=redirect&bpo=39209]: Correctly handle multiline tokens in interactive mode. Patch by Pablo Galindo.
bpo-1635741 [https://bugs.python.org/issue?@action=redirect&bpo=1635741]: Port _json extension module to multiphase initialization ( PEP 489 [https://peps.python.org/pep-0489/]).
bpo-39216 [https://bugs.python.org/issue?@action=redirect&bpo=39216]: Fix constant folding optimization for positional only arguments - by Anthony Sottile.
bpo-39215 [https://bugs.python.org/issue?@action=redirect&bpo=39215]: Fix
SystemError
when nested function has annotation on positional-only argument - by Anthony Sottile.bpo-39200 [https://bugs.python.org/issue?@action=redirect&bpo=39200]: Correct the error message when calling the
min()
ormax()
with no arguments. Patch by Donghee Na.bpo-39200 [https://bugs.python.org/issue?@action=redirect&bpo=39200]: Correct the error message when trying to construct
range
objects with no arguments. Patch by Pablo Galindo.bpo-39166 [https://bugs.python.org/issue?@action=redirect&bpo=39166]: Fix incorrect line execution reporting in trace functions when tracing the last iteration of asynchronous for loops. Patch by Pablo Galindo.
bpo-39114 [https://bugs.python.org/issue?@action=redirect&bpo=39114]: Fix incorrect line execution reporting in trace functions when tracing exception handlers with name binding. Patch by Pablo Galindo.
bpo-39156 [https://bugs.python.org/issue?@action=redirect&bpo=39156]: Split the COMPARE_OP bytecode instruction into four distinct instructions.
COMPARE_OP for rich comparisons
IS_OP for 'is' and 'is not' tests
CONTAINS_OP for 'in' and 'is not' tests
JUMP_IF_NOT_EXC_MATCH for checking exceptions in 'try-except' statements.
This improves the clarity of the interpreter and should provide a modest speedup.
bpo-38588 [https://bugs.python.org/issue?@action=redirect&bpo=38588]: Fix possible crashes in dict and list when calling
PyObject_RichCompareBool()
.bpo-13601 [https://bugs.python.org/issue?@action=redirect&bpo=13601]: By default,
sys.stderr
is line-buffered now, even ifstderr
is redirected to a file. You can still makesys.stderr
unbuffered by passing the-u
commandline option or setting thePYTHONUNBUFFERED
environment variable.
(Contributed by Jendrik Seipp in bpo-13601 [https://bugs.python.org/issue?@action=redirect&bpo=13601].)
bpo-38610 [https://bugs.python.org/issue?@action=redirect&bpo=38610]: Fix possible crashes in several list methods by holding strong references to list elements when calling
PyObject_RichCompareBool()
.bpo-32021 [https://bugs.python.org/issue?@action=redirect&bpo=32021]: Include brotli .br encoding in mimetypes encodings_map
库
bpo-39430 [https://bugs.python.org/issue?@action=redirect&bpo=39430]: Fixed race condition in lazy imports in
tarfile
.bpo-39413 [https://bugs.python.org/issue?@action=redirect&bpo=39413]: The
os.unsetenv()
function is now also available on Windows.bpo-39390 [https://bugs.python.org/issue?@action=redirect&bpo=39390]: Fixed a regression with the
ignore
callback ofshutil.copytree()
. The argument types are nowstr
andList[str]
again.bpo-39395 [https://bugs.python.org/issue?@action=redirect&bpo=39395]: The
os.putenv()
andos.unsetenv()
functions are now always available.bpo-39406 [https://bugs.python.org/issue?@action=redirect&bpo=39406]: If
setenv()
C function is available,os.putenv()
is now implemented withsetenv()
instead ofputenv()
, so Python doesn't have to handle the environment variable memory.bpo-39396 [https://bugs.python.org/issue?@action=redirect&bpo=39396]: Fix
math.nextafter(-0.0, +0.0)
on AIX 7.1.bpo-29435 [https://bugs.python.org/issue?@action=redirect&bpo=29435]: Allow
tarfile.is_tarfile()
to be used with file and file-like objects, likezipfile.is_zipfile()
. Patch by William Woodruff.bpo-39377 [https://bugs.python.org/issue?@action=redirect&bpo=39377]: Removed
encoding
option fromjson.loads()
. It has been deprecated since Python 3.1.bpo-39389 [https://bugs.python.org/issue?@action=redirect&bpo=39389]: Write accurate compression level metadata in
gzip
archives, rather than always signaling maximum compression.bpo-39366 [https://bugs.python.org/issue?@action=redirect&bpo=39366]: The previously deprecated
xpath()
andxgtitle()
methods ofnntplib.NNTP
have been removed.bpo-39357 [https://bugs.python.org/issue?@action=redirect&bpo=39357]: Remove the buffering parameter of
bz2.BZ2File
. Since Python 3.0, it was ignored and using it was emittingDeprecationWarning
. Pass an open file object, to control how the file is opened. The compresslevel parameter becomes keyword-only.bpo-39353 [https://bugs.python.org/issue?@action=redirect&bpo=39353]: Deprecate binhex4 and hexbin4 standards. Deprecate the
binhex
module and the followingbinascii
functions:b2a_hqx()
,a2b_hqx()
,rlecode_hqx()
,rledecode_hqx()
,crc_hqx()
.bpo-39351 [https://bugs.python.org/issue?@action=redirect&bpo=39351]: Remove
base64.encodestring()
andbase64.decodestring()
, aliases deprecated since Python 3.1: usebase64.encodebytes()
andbase64.decodebytes()
instead.bpo-39350 [https://bugs.python.org/issue?@action=redirect&bpo=39350]: Remove
fractions.gcd()
function, deprecated since Python 3.5 (bpo-22486 [https://bugs.python.org/issue?@action=redirect&bpo=22486]): usemath.gcd()
instead.bpo-39329 [https://bugs.python.org/issue?@action=redirect&bpo=39329]:
LMTP
constructor now has an optional timeout parameter. Patch by Donghee Na.bpo-39313 [https://bugs.python.org/issue?@action=redirect&bpo=39313]: Add a new
exec_function
option (—exec-function in the CLI) toRefactoringTool
for makingexec
a function. Patch by Batuhan Taskaya.bpo-39259 [https://bugs.python.org/issue?@action=redirect&bpo=39259]:
FTP_TLS
andFTP_TLS
now raise aValueError
if the given timeout for their constructor is zero to prevent the creation of a nonblocking socket. Patch by Donghee Na.bpo-39259 [https://bugs.python.org/issue?@action=redirect&bpo=39259]:
SMTP
andSMTP_SSL
now raise aValueError
if the given timeout for their constructor is zero to prevent the creation of a nonblocking socket. Patch by Donghee Na.bpo-39310 [https://bugs.python.org/issue?@action=redirect&bpo=39310]: Add
math.ulp()
: return the value of the least significant bit of a float.bpo-39297 [https://bugs.python.org/issue?@action=redirect&bpo=39297]: Improved performance of importlib.metadata distribution discovery and resilients to inaccessible sys.path entries (importlib_metadata v1.4.0).
bpo-39259 [https://bugs.python.org/issue?@action=redirect&bpo=39259]:
NNTP
andNNTP_SSL
now raise aValueError
if the given timeout for their constructor is zero to prevent the creation of a nonblocking socket. Patch by Donghee Na.bpo-38901 [https://bugs.python.org/issue?@action=redirect&bpo=38901]: When you specify prompt='.' or equivalently python -m venv —prompt . … the basename of the current directory is used to set the created venv's prompt when it's activated.
bpo-39288 [https://bugs.python.org/issue?@action=redirect&bpo=39288]: Add
math.nextafter()
: return the next floating-point value after x towards y.bpo-39259 [https://bugs.python.org/issue?@action=redirect&bpo=39259]:
POP3
andPOP3_SSL
now raise aValueError
if the given timeout for their constructor is zero to prevent the creation of a nonblocking socket. Patch by Donghee Na.bpo-39242 [https://bugs.python.org/issue?@action=redirect&bpo=39242]: Updated the Gmane domain from news.gmane.org to news.gmane.io which is used for examples of
NNTP
news reader server and nntplib tests.bpo-35292 [https://bugs.python.org/issue?@action=redirect&bpo=35292]: Proxy the
SimpleHTTPRequestHandler.guess_type
tomimetypes.guess_type
so themimetypes.init
is called lazily to avoid unnecessary costs whenhttp.server
module is imported.bpo-39239 [https://bugs.python.org/issue?@action=redirect&bpo=39239]: The
select.epoll.unregister()
method no longer ignores theEBADF
error.bpo-38907 [https://bugs.python.org/issue?@action=redirect&bpo=38907]: In http.server script, restore binding to IPv4 on Windows.
bpo-39152 [https://bugs.python.org/issue?@action=redirect&bpo=39152]: Fix ttk.Scale.configure([name]) to return configuration tuple for name or all options. Giovanni Lombardo contributed part of the patch.
bpo-39198 [https://bugs.python.org/issue?@action=redirect&bpo=39198]: If an exception were to be thrown in
Logger.isEnabledFor
(say, by asyncio timeouts or stopit) , thelogging
global lock may not be released appropriately, resulting in deadlock. This change wraps that block of code withtry…finally
to ensure the lock is released.bpo-39191 [https://bugs.python.org/issue?@action=redirect&bpo=39191]: Perform a check for running loop before starting a new task in
loop.run_until_complete()
to fail fast; it prevents the side effect of new task spawning before exception raising.bpo-38871 [https://bugs.python.org/issue?@action=redirect&bpo=38871]: Correctly parenthesize filter-based statements that contain lambda expressions in
lib2to3
. Patch by Donghee Na.bpo-39142 [https://bugs.python.org/issue?@action=redirect&bpo=39142]: A change was made to logging.config.dictConfig to avoid converting instances of named tuples to ConvertingTuple. It's assumed that named tuples are too specialised to be treated like ordinary tuples; if a user of named tuples requires ConvertingTuple functionality, they will have to implement that themselves in their named tuple class.
bpo-39158 [https://bugs.python.org/issue?@action=redirect&bpo=39158]: ast.literal_eval() now supports empty sets.
bpo-39129 [https://bugs.python.org/issue?@action=redirect&bpo=39129]: Fix import path for
asyncio.TimeoutError
bpo-39057 [https://bugs.python.org/issue?@action=redirect&bpo=39057]:
urllib.request.proxy_bypass_environment()
now ignores leading dots and no longer ignores a trailing newline.bpo-39056 [https://bugs.python.org/issue?@action=redirect&bpo=39056]: Fixed handling invalid warning category in the -W option. No longer import the re module if it is not needed.
bpo-39055 [https://bugs.python.org/issue?@action=redirect&bpo=39055]:
base64.b64decode()
withvalidate=True
raises now a binascii.Error if the input ends with a single\n
.bpo-21600 [https://bugs.python.org/issue?@action=redirect&bpo=21600]: Fix
mock.patch.stopall()
to stop active patches that were created withmock.patch.dict()
.bpo-39019 [https://bugs.python.org/issue?@action=redirect&bpo=39019]: Implement dummy
__class_getitem__
fortempfile.SpooledTemporaryFile
.bpo-39019 [https://bugs.python.org/issue?@action=redirect&bpo=39019]: Implement dummy
__class_getitem__
forsubprocess.Popen
,subprocess.CompletedProcess
bpo-38914 [https://bugs.python.org/issue?@action=redirect&bpo=38914]: Adjusted the wording of the warning issued by distutils'
check
command when theauthor
andmaintainer
fields are supplied but no corresponding e-mail field (author_email
ormaintainer_email
) is found. The wording now reflects the fact that these fields are suggested, but not required. Patch by Juergen Gmach.bpo-38878 [https://bugs.python.org/issue?@action=redirect&bpo=38878]: Fixed subclasshook of
os.PathLike
to return a correct result upon inheritance. Patch by Bar Harel.bpo-38615 [https://bugs.python.org/issue?@action=redirect&bpo=38615]:
IMAP4
andIMAP4_SSL
now have an optional timeout parameter for their constructors. Also, theopen()
method now has an optional timeout parameter with this change. The overridden methods ofIMAP4_SSL
andIMAP4_stream
were applied to this change. Patch by Donghee Na.bpo-35182 [https://bugs.python.org/issue?@action=redirect&bpo=35182]: Fixed
Popen.communicate()
subsequent call crash when the child process has already closed any piped standard stream, but still continues to be running. Patch by Andriy Maletsky.bpo-38630 [https://bugs.python.org/issue?@action=redirect&bpo=38630]: On Unix,
subprocess.Popen.send_signal()
now polls the process status. Polling reduces the risk of sending a signal to the wrong process if the process completed, thesubprocess.Popen.returncode
attribute is stillNone
, and the pid has been reassigned (recycled) to a new different process.bpo-38536 [https://bugs.python.org/issue?@action=redirect&bpo=38536]: Removes trailing space in formatted currency with
international=True
and a locale with symbol following value. E.g.locale.currency(12.34, international=True)
returned'12,34 EUR '
instead of'12,34 EUR'
.bpo-38473 [https://bugs.python.org/issue?@action=redirect&bpo=38473]: Use signature from inner mock for autospecced methods attached with
unittest.mock.attach_mock()
. Patch by Karthikeyan Singaravelan.bpo-38361 [https://bugs.python.org/issue?@action=redirect&bpo=38361]: Fixed an issue where
ident
could include a leading path separator whensyslog.openlog()
was called without arguments.bpo-38293 [https://bugs.python.org/issue?@action=redirect&bpo=38293]: Add
copy.copy()
andcopy.deepcopy()
support toproperty()
objects.bpo-37958 [https://bugs.python.org/issue?@action=redirect&bpo=37958]: Added the pstats.Stats.get_profile_dict() method to return the profile data as a StatsProfile instance.
bpo-28367 [https://bugs.python.org/issue?@action=redirect&bpo=28367]: Termios magic constants for the following baud rates: - B500000 - B576000 - B921600 - B1000000 - B1152000 - B1500000 - B2000000 - B2500000 - B3000000 - B3500000 - B4000000 Patch by Andrey Smirnov
文档
bpo-39381 [https://bugs.python.org/issue?@action=redirect&bpo=39381]: Mention in docs that
asyncio.get_event_loop()
implicitly creates new event loop only if called from the main thread.bpo-38918 [https://bugs.python.org/issue?@action=redirect&bpo=38918]: Add an entry for
__module__
in the "function" & "method" sections of theinspect
docs' 类型和成员 table.bpo-3530 [https://bugs.python.org/issue?@action=redirect&bpo=3530]: In the
ast
module documentation, fix a misleadingNodeTransformer
example and add advice on when to use thefixmissinglocations
function.