C API

Just remove the underscore prefix to update your code. Patch by Victor Stinner.

Patch by Victor Stinner.

Patch by Victor Stinner.

Patch by Victor Stinner.

Python 3.12.0 beta 1

Release date: 2023-05-22

安全性

核心与内置函数

A new type X = … syntax is added for type aliases, which resolves at runtime to an instance of the new class typing.TypeAliasType. The value is lazily evaluated and is accessible through the .__value__ attribute. This is implemented as a new AST node ast.TypeAlias.

New syntax (class X[T]: …, def funcT: …) is added for defining generic functions and classes. This is implemented as a new type_params attribute on the AST nodes for classes and functions. This node holds instances of the new AST classes ast.TypeVar, ast.ParamSpec, and ast.TypeVarTuple.

typing.TypeVar, typing.ParamSpec, typing.ParamSpecArgs, typing.ParamSpecKwargs, typing.TypeVarTuple, and typing.Generic are now implemented in C rather than Python.

There are new bytecode instructions LOAD_LOCALS, LOAD_CLASSDICT_OR_GLOBAL, and LOAD_CLASSDICT_OR_DEREF to support correct resolution of names in class namespaces.

Patch by Eric Traut, Larry Hastings, and Jelle Zijlstra.

文档

测试

构建

Patch by Zhang Na.

Windows

macOS

IDLE

工具/示例

C API

Python 3.12.0 alpha 7

Release date: 2023-04-04