macOS
- gh-97897 [https://github.com/python/cpython/issues/97897]: The macOS 13 SDK includes support for the
mkfifoat
andmknodat
system calls. Using thedir_fd
option with eitheros.mkfifo()
oros.mknod()
could result in a segfault if cpython is built with the macOS 13 SDK but run on an earlier version of macOS. Prevent this by adding runtime support for detection of these system calls ("weaklinking") as is done for other newer syscalls on macOS.
IDLE
gh-97527 [https://github.com/python/cpython/issues/97527]: Fix a bug in the previous bugfix that caused IDLE to not start when run with 3.10.8, 3.12.0a1, and at least Microsoft Python 3.10.2288.0 installed without the Lib/test package. 3.11.0 was never affected.
gh-65802 [https://github.com/python/cpython/issues/65802]: Document handling of extensions in Save As dialogs.
gh-95191 [https://github.com/python/cpython/issues/95191]: Include prompts when saving Shell (interactive input and output).
gh-95511 [https://github.com/python/cpython/issues/95511]: Fix the Shell context menu copy-with-prompts bug of copying an extra line when one selects whole lines.
gh-95471 [https://github.com/python/cpython/issues/95471]: In the Edit menu, move
Select All
and add a new separator.gh-95411 [https://github.com/python/cpython/issues/95411]: Enable using IDLE's module browser with .pyw files.
gh-89610 [https://github.com/python/cpython/issues/89610]: Add .pyi as a recognized extension for IDLE on macOS. This allows opening stub files by double clicking on them in the Finder.
工具/示例
gh-68686 [https://github.com/python/cpython/issues/68686]: Remove ptags and eptags scripts.
gh-97681 [https://github.com/python/cpython/issues/97681]: Remove the
Tools/demo/
directory which contained old demo scripts. A copy can be found in the old-demos project [https://github.com/gvanrossum/old-demos]. Patch by Victor Stinner.gh-97669 [https://github.com/python/cpython/issues/97669]: Remove outdated example scripts of the
Tools/scripts/
directory. A copy can be found in the old-demos project [https://github.com/gvanrossum/old-demos]. Patch by Victor Stinner.gh-95853 [https://github.com/python/cpython/issues/95853]: The
wasm_build.py
script now pre-builds Emscripten ports, checks for broken EMSDK versions, and warns about pkg-config env vars.gh-95853 [https://github.com/python/cpython/issues/95853]: The new tool
Tools/wasm/wasm_builder.py
automates configure, compile, and test steps for building CPython on WebAssembly platforms.gh-95731 [https://github.com/python/cpython/issues/95731]: Fix handling of module docstrings in
Tools/i18n/pygettext.py
.gh-93939 [https://github.com/python/cpython/issues/93939]: Add script
Tools/scripts/check_modules.py
to check and validate builtin and shared extension modules. The script also handlesModules/Setup
and will eventually replacesetup.py
.gh-94538 [https://github.com/python/cpython/issues/94538]: Fix Argument Clinic output to custom file destinations. Patch by Erlend E. Aasland.
gh-94430 [https://github.com/python/cpython/issues/94430]: Allow parameters named
module
andself
with custom C names in Argument Clinic. Patch by Erlend E. Aaslandgh-86087 [https://github.com/python/cpython/issues/86087]: The
Tools/scripts/parseentities.py
script used to parse HTML4 entities has been removed.
C API
gh-98393 [https://github.com/python/cpython/issues/98393]: The
PyUnicode_FSDecoder()
function no longer accepts bytes-like paths, likebytearray
andmemoryview
types: only the exactbytes
type is accepted for bytes strings. Patch by Victor Stinner.gh-91051 [https://github.com/python/cpython/issues/91051]: Add
PyType_Watch()
and related APIs to allow callbacks onPyType_Modified()
.gh-95756 [https://github.com/python/cpython/issues/95756]: Lazily create and cache
co_
attributes for better performance for code getters.gh-96512 [https://github.com/python/cpython/issues/96512]: Configuration for the integer string conversion length limitation now lives in the PyConfig C API struct.
gh-95589 [https://github.com/python/cpython/issues/95589]: Extensions classes that set
tp_dictoffset
andtp_weaklistoffset
lose the support for multiple inheritance, but are now safe. Extension classes should usePy_TPFLAGS_MANAGED_DICT
andPy_TPFLAGS_MANAGED_WEAKREF
instead.gh-95781 [https://github.com/python/cpython/issues/95781]: An unrecognized format character in
PyUnicode_FromFormat()
andPyUnicode_FromFormatV()
now sets aSystemError
. In previous versions it caused all the rest of the format string to be copied as-is to the result string, and any extra arguments discarded.gh-92678 [https://github.com/python/cpython/issues/92678]: Restore the 3.10 behavior for multiple inheritance of C extension classes that store their dictionary at the end of the struct.
gh-92678 [https://github.com/python/cpython/issues/92678]: Support C extensions using managed dictionaries by setting the
Py_TPFLAGS_MANAGED_DICT
flag.gh-93274 [https://github.com/python/cpython/issues/93274]: API for implementing vectorcall (
Py_TPFLAGS_HAVE_VECTORCALL
,PyVectorcall_NARGS()
andPyVectorcall_Call()
) was added to the limited API and stable ABI.gh-95504 [https://github.com/python/cpython/issues/95504]: Fix sign placement when specifying width or precision in
PyUnicode_FromFormat()
andPyUnicode_FromFormatV()
. Patch by Philip Georgi.gh-93012 [https://github.com/python/cpython/issues/93012]: The
Py_TPFLAGS_HAVE_VECTORCALL
flag is now removed from a class when the class's__call__()
method is reassigned. This makes vectorcall safe to use with mutable types (i.e. heap types without theimmutable
flag). Mutable types that do not overridetp_call
now inherit thePy_TPFLAGS_HAVE_VECTORCALL
flag.gh-95388 [https://github.com/python/cpython/issues/95388]: Creating
immutable types
with mutable bases is deprecated and is planned to be disabled in Python 3.14.gh-92678 [https://github.com/python/cpython/issues/92678]: Adds unstable C-API functions
PyObjectVisitManagedDict
andPyObjectClearManagedDict
to allow C extensions to allow the VM to manage their object's dictionaries.gh-94936 [https://github.com/python/cpython/issues/94936]: Added
PyCode_GetVarnames()
,PyCode_GetCellvars()
andPyCode_GetFreevars()
for accessingco_varnames
,co_cellvars
andco_freevars
respectively via the C API.gh-94930 [https://github.com/python/cpython/issues/94930]: Fix
SystemError
raised whenPyArg_ParseTupleAndKeywords()
is used with#
in(…)
but withoutPY_SSIZE_T_CLEAN
defined.gh-94731 [https://github.com/python/cpython/issues/94731]: Python again uses C-style casts for most casting operations when compiled with C++. This may trigger compiler warnings, if they are enabled with e.g.
-Wold-style-cast
or-Wzero-as-null-pointer-constant
options forg++
.gh-93937 [https://github.com/python/cpython/issues/93937]: The following frame functions and type are now directly available with
#include
, it's no longer needed to add#include
:
Patch by Victor Stinner.
gh-91321 [https://github.com/python/cpython/issues/91321]: Fix the compatibility of the Python C API with C++ older than C++11. Patch by Victor Stinner.
gh-91731 [https://github.com/python/cpython/issues/91731]: Avoid defining the
static_assert
when compiling with C++ 11, where this is a keyword and redefining it can lead to undefined behavior. Patch by Pablo Galindogh-89546 [https://github.com/python/cpython/issues/89546]:
PyType_FromMetaclass()
(and otherPyType_From*
functions) now check that offsets and the base class'stp_basicsize
fit in the new class'stp_basicsize
.gh-93503 [https://github.com/python/cpython/issues/93503]: Add two new public functions to the public C-API,
PyEval_SetProfileAllThreads()
andPyEval_SetTraceAllThreads()
, that allow to set tracing and profiling functions in all running threads in addition to the calling one. Also, two analogous functions to thethreading
module (threading.setprofile_all_threads()
andthreading.settrace_all_threads()
) that allow to do the same from Python. Patch by Pablo Galindogh-93442 [https://github.com/python/cpython/issues/93442]: Add C++ overloads for PyCAST_impl() to handle 0/NULL. This will allow C++ extensions that pass 0 or NULL to macros using PyCAST() to continue to compile.
gh-93466 [https://github.com/python/cpython/issues/93466]: Slot IDs in PyType_Spec may not be repeated. The documentation was updated to mention this. For some cases of repeated slots, PyType_FromSpec and related functions will now raise an exception.
gh-92898 [https://github.com/python/cpython/issues/92898]: Fix C++ compiler warnings when casting function arguments to
PyObject*
. Patch by Serge Guelton.gh-93103 [https://github.com/python/cpython/issues/93103]: Deprecate global configuration variables, like
Py_IgnoreEnvironmentFlag
, in the documentation: thePy_InitializeFromConfig()
API should be instead. Patch by Victor Stinner.gh-77782 [https://github.com/python/cpython/issues/77782]: Deprecate global configuration variable like
Py_IgnoreEnvironmentFlag
: thePy_InitializeFromConfig()
API should be instead. Patch by Victor Stinner.gh-92913 [https://github.com/python/cpython/issues/92913]: Ensures changes to
PyConfig.module_search_paths
are ignored unlessPyConfig.module_search_paths_set
is setgh-92781 [https://github.com/python/cpython/issues/92781]: Avoid mixing declarations and code in the C API to fix the compiler warning: "ISO C90 forbids mixed declarations and code" [-Werror=declaration-after-statement]. Patch by Victor Stinner.
gh-92651 [https://github.com/python/cpython/issues/92651]: Remove the
token.h
header file. There was never any public tokenizer C API. Thetoken.h
header file was only designed to be used by Python internals. Patch by Victor Stinner.gh-92536 [https://github.com/python/cpython/issues/92536]: Remove legacy Unicode APIs based on
Py_UNICODE*
.gh-85858 [https://github.com/python/cpython/issues/85858]: Remove the
PyUnicode_InternImmortal()
function and theSSTATE_INTERNED_IMMORTAL
macro. Patch by Victor Stinner.gh-92193 [https://github.com/python/cpython/issues/92193]: Add new function
PyFunction_SetVectorcall()
to the C API which sets the vectorcall field of a givenPyFunctionObject
.
Warning: extensions using this API must preserve the behavior of the unaltered function!
gh-59121 [https://github.com/python/cpython/issues/59121]: Fixed an assert that prevented
PyRun_InteractiveOne
from providing tracebacks when parsing from the provided FD.bpo-45383 [https://bugs.python.org/issue?@action=redirect&bpo=45383]: The
PyType_FromSpec()
API will now find and use a metaclass based on the provided bases. An error will be raised if there is a metaclass conflict.
Python 3.11.0 beta 1
Release date: 2022-05-06
安全性
- gh-57684 [https://github.com/python/cpython/issues/57684]: Add the
-P
command line option and thePYTHONSAFEPATH
environment variable to not prepend a potentially unsafe path tosys.path
. Patch by Victor Stinner.
核心与内置函数
gh-89519 [https://github.com/python/cpython/issues/89519]: Chaining classmethod descriptors (introduced in bpo-19072 [https://bugs.python.org/issue?@action=redirect&bpo=19072]) is deprecated. It can no longer be used to wrap other descriptors such as property(). The core design of this feature was flawed, and it caused a number of downstream problems.
gh-92345 [https://github.com/python/cpython/issues/92345]:
pymainrunpython()
now importsreadline
andrlcompleter
before sys.path is extended to include the current working directory of an interactive interpreter. Non-interactive interpreters are not affected.bpo-43857 [https://bugs.python.org/issue?@action=redirect&bpo=43857]: Improve the
AttributeError
message when deleting a missing attribute. Patch by Géry Ogam.gh-92245 [https://github.com/python/cpython/issues/92245]: Make sure that PEP 523 is respected in all cases. In 3.11a7, specialization may have prevented Python-to-Python calls respecting PEP 523.
gh-92203 [https://github.com/python/cpython/issues/92203]: Add a closure keyword-only parameter to
exec()
. It can only be specified when exec-ing a code object that uses free variables. When specified, it must be a tuple, with exactly the number of cell variables referenced by the code object. closure has a default value ofNone
, and it must beNone
if the code object doesn't refer to any free variables.gh-91173 [https://github.com/python/cpython/issues/91173]: Disable frozen modules in debug builds. Patch by Kumar Aditya.
gh-92114 [https://github.com/python/cpython/issues/92114]: Improve error message when subscript a type with
__class_getitem__
set toNone
.gh-92112 [https://github.com/python/cpython/issues/92112]: Fix crash triggered by an evil custom
mro()
on a metaclass.gh-92063 [https://github.com/python/cpython/issues/92063]: The
PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS
instruction now ensures methods are called only on objects of the correct type.gh-92031 [https://github.com/python/cpython/issues/92031]: Deoptimize statically allocated code objects during
Py_FINALIZE()
so that futurePyCodeQuicken
calls always start with unquickened code.gh-92036 [https://github.com/python/cpython/issues/92036]: Fix a crash in subinterpreters related to the garbage collector. When a subinterpreter is deleted, untrack all objects tracked by its GC. To prevent a crash in deallocator functions expecting objects to be tracked by the GC, leak a strong reference to these objects on purpose, so they are never deleted and their deallocator functions are not called. Patch by Victor Stinner.
gh-92032 [https://github.com/python/cpython/issues/92032]: The interpreter can now autocomplete soft keywords, as of now
match
,case
, and_
(wildcard pattern) from PEP 634 [https://peps.python.org/pep-0634/].gh-87999 [https://github.com/python/cpython/issues/87999]: The warning emitted by the Python parser for a numeric literal immediately followed by keyword has been changed from deprecation warning to syntax warning.
gh-91869 [https://github.com/python/cpython/issues/91869]: Fix an issue where specialized opcodes with extended arguments could produce incorrect tracing output or lead to assertion failures.
gh-91603 [https://github.com/python/cpython/issues/91603]: Speed up
types.UnionType
instantiation. Based on patch provided by Yurii Karabas.gh-89373 [https://github.com/python/cpython/issues/89373]: If Python is built in debug mode, Python now ensures that deallocator functions leave the current exception unchanged. Patch by Victor Stinner.
gh-91632 [https://github.com/python/cpython/issues/91632]: Fix a minor memory leak at exit: release the memory of the
generic_alias_iterator
type. Patch by Donghee Na.gh-81548 [https://github.com/python/cpython/issues/81548]: Octal escapes with value larger than
0o377
now produce aDeprecationWarning
. In a future Python version they will be aSyntaxWarning
and eventually aSyntaxError
.bpo-43950 [https://bugs.python.org/issue?@action=redirect&bpo=43950]: Use a single compact table for line starts, ends and column offsets. Reduces memory consumption for location info by half
gh-91102 [https://github.com/python/cpython/issues/91102]: Use Argument Clinic for
EncodingMap
. Patch by Oleg Iarygin.gh-91636 [https://github.com/python/cpython/issues/91636]: Fixed a crash in a garbage-collection edge-case, in which a
PyFunction_Type.tp_clear
function could leave a python function object in an inconsistent state.gh-91603 [https://github.com/python/cpython/issues/91603]: Speed up
isinstance()
andissubclass()
checks fortypes.UnionType
. Patch by Yurii Karabas.gh-91625 [https://github.com/python/cpython/issues/91625]: Fixed a bug in which adaptive opcodes ignored any preceding
EXTENDED_ARG
s on specialization failure.gh-78607 [https://github.com/python/cpython/issues/78607]: The LLTRACE special build now looks for the name
__lltrace__
defined in module globals, rather than the name__ltrace__
, which had been introduced as a typo.gh-91576 [https://github.com/python/cpython/issues/91576]: Speed up iteration of ascii strings by 50%. Patch by Kumar Aditya.
gh-89279 [https://github.com/python/cpython/issues/89279]: Improve interpreter performance on Windows by inlining a few specific macros.
gh-91502 [https://github.com/python/cpython/issues/91502]: Add a new
PyFrameIsEntryFrame()
API function, to check if aPyFrameObject
is an entry frame. Patch by Pablo Galindo.gh-91266 [https://github.com/python/cpython/issues/91266]: Refactor the
bytearray
strip methodsstrip
,lstrip
andrstrip
to use a common implementation.gh-91479 [https://github.com/python/cpython/issues/91479]: Replaced the
__note__
field ofBaseException
(added in an earlier version of 3.11) with the final design of PEP 678 [https://peps.python.org/pep-0678/]. Namely,BaseException
gets anadd_note()
method, and its__notes__
field is created when necessary.gh-46055 [https://github.com/python/cpython/issues/46055]: Speed up right shift of negative integers, by removing unnecessary creation of temporaries. Original patch by Xinhang Xu, reworked by Mark Dickinson.
gh-91462 [https://github.com/python/cpython/issues/91462]: Make the interpreter's low-level tracing (lltrace) feature output more readable by displaying opcode names (rather than just numbers), and by displaying stack contents before each opcode.
gh-89455 [https://github.com/python/cpython/issues/89455]: Fixed an uninitialized bool value in the traceback printing code path that was introduced by the initial bpo-45292 [https://bugs.python.org/issue?@action=redirect&bpo=45292] exception groups work.
gh-91421 [https://github.com/python/cpython/issues/91421]: Fix a potential integer overflow in PyDecodeUTF8Ex.
gh-91428 [https://github.com/python/cpython/issues/91428]: Add
static const char *const PyOpcodeOpName[256] = {…};
toopcode.h
for debug builds to assist in debugging the Python interpreter. It is now more convenient to make various forms of debugging output more human-readable by including opcode names rather than just the corresponding decimal digits.bpo-47120 [https://bugs.python.org/issue?@action=redirect&bpo=47120]: Make
POP_JUMP_IF_TRUE
,POP_JUMP_IF_FALSE
,POP_JUMP_IF_NONE
andPOP_JUMP_IF_NOT_NONE
virtual, mapping to new relative jump opcodes.bpo-45317 [https://bugs.python.org/issue?@action=redirect&bpo=45317]: Add internal documentation explaining design of new (for 3.11) frame stack.
bpo-47197 [https://bugs.python.org/issue?@action=redirect&bpo=47197]: ctypes used to mishandle
void
return types, so that for instance a function declared likectypes.CFUNCTYPE(None, ctypes.c_int)
would be called with signatureint f(int)
instead ofvoid f(int)
. Wasm targets require function pointers to be called with the correct signatures so this led to crashes. The problem is now fixed.bpo-47120 [https://bugs.python.org/issue?@action=redirect&bpo=47120]: Make opcodes
JUMP_IF_TRUE_OR_POP
andJUMP_IF_FALSE_OR_POP
relative rather than absolute.bpo-47177 [https://bugs.python.org/issue?@action=redirect&bpo=47177]: Replace the
f_lasti
member of the internal_PyInterpreterFrame
structure with aprev_instr
pointer, which reduces overhead in the main interpreter loop. Thef_lasti
attribute of Python-layer frame objects is preserved for backward-compatibility.bpo-46961 [https://bugs.python.org/issue?@action=redirect&bpo=46961]: Integer mod/remainder operations, including the three-argument form of
pow()
, now consistently return ints from the global small integer cache when applicable.bpo-46962 [https://bugs.python.org/issue?@action=redirect&bpo=46962]: Classes and functions that unconditionally declared their docstrings ignoring the
--without-doc-strings
compilation flag no longer do so.
The classes affected are ctypes.UnionType
, pickle.PickleBuffer
, testcapi.RecursingInfinitelyError
, and types.GenericAlias
.
The functions affected are 24 methods in ctypes
.
Patch by Oleg Iarygin.
bpo-46942 [https://bugs.python.org/issue?@action=redirect&bpo=46942]: Use Argument Clinic for the
types.MethodType
constructor. Patch by Oleg Iarygin.bpo-46764 [https://bugs.python.org/issue?@action=redirect&bpo=46764]: Fix wrapping bound methods with @classmethod
bpo-43464 [https://bugs.python.org/issue?@action=redirect&bpo=43464]: Optimize
set.intersection()
for non-set arguments.bpo-46721 [https://bugs.python.org/issue?@action=redirect&bpo=46721]: Optimize
set.issuperset()
for non-set argument.bpo-46509 [https://bugs.python.org/issue?@action=redirect&bpo=46509]: Add type-specialized versions of the
Py_DECREF()
, and use them forfloat
,int
,str
,bool
, andNone
to avoid pointer-chasing at runtime where types are known at C compile time.bpo-46045 [https://bugs.python.org/issue?@action=redirect&bpo=46045]: Do not use POSIX semaphores on NetBSD
bpo-36819 [https://bugs.python.org/issue?@action=redirect&bpo=36819]: Fix crashes in builtin encoders with error handlers that return position less or equal than the starting position of non-encodable characters.
bpo-34093 [https://bugs.python.org/issue?@action=redirect&bpo=34093]:
marshal.dumps()
usesFLAG_REF
for all interned strings. This makes output more deterministic and helps reproducible build.bpo-26579 [https://bugs.python.org/issue?@action=redirect&bpo=26579]: Added
object.__getstate__
which provides the default implementation of the__getstate__()
method.
Copying and pickling instances of subclasses of builtin types bytearray, set, frozenset, collections.OrderedDict, collections.deque, weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes implemented as slots.