mirror of
https://github.com/python/cpython.git
synced 2025-10-28 09:10:36 +00:00
gh-116126: Implement PEP 696 (#116129)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This commit is contained in:
parent
852263e108
commit
ca269e58c2
28 changed files with 1924 additions and 623 deletions
20
Include/internal/pycore_ast.h
generated
20
Include/internal/pycore_ast.h
generated
|
|
@ -657,14 +657,17 @@ struct _type_param {
|
|||
struct {
|
||||
identifier name;
|
||||
expr_ty bound;
|
||||
expr_ty default_value;
|
||||
} TypeVar;
|
||||
|
||||
struct {
|
||||
identifier name;
|
||||
expr_ty default_value;
|
||||
} ParamSpec;
|
||||
|
||||
struct {
|
||||
identifier name;
|
||||
expr_ty default_value;
|
||||
} TypeVarTuple;
|
||||
|
||||
} v;
|
||||
|
|
@ -892,14 +895,15 @@ pattern_ty _PyAST_MatchOr(asdl_pattern_seq * patterns, int lineno, int
|
|||
col_offset, int end_lineno, int end_col_offset,
|
||||
PyArena *arena);
|
||||
type_ignore_ty _PyAST_TypeIgnore(int lineno, string tag, PyArena *arena);
|
||||
type_param_ty _PyAST_TypeVar(identifier name, expr_ty bound, int lineno, int
|
||||
col_offset, int end_lineno, int end_col_offset,
|
||||
PyArena *arena);
|
||||
type_param_ty _PyAST_ParamSpec(identifier name, int lineno, int col_offset, int
|
||||
end_lineno, int end_col_offset, PyArena *arena);
|
||||
type_param_ty _PyAST_TypeVarTuple(identifier name, int lineno, int col_offset,
|
||||
int end_lineno, int end_col_offset, PyArena
|
||||
*arena);
|
||||
type_param_ty _PyAST_TypeVar(identifier name, expr_ty bound, expr_ty
|
||||
default_value, int lineno, int col_offset, int
|
||||
end_lineno, int end_col_offset, PyArena *arena);
|
||||
type_param_ty _PyAST_ParamSpec(identifier name, expr_ty default_value, int
|
||||
lineno, int col_offset, int end_lineno, int
|
||||
end_col_offset, PyArena *arena);
|
||||
type_param_ty _PyAST_TypeVarTuple(identifier name, expr_ty default_value, int
|
||||
lineno, int col_offset, int end_lineno, int
|
||||
end_col_offset, PyArena *arena);
|
||||
|
||||
|
||||
PyObject* PyAST_mod2obj(mod_ty t);
|
||||
|
|
|
|||
1
Include/internal/pycore_ast_state.h
generated
1
Include/internal/pycore_ast_state.h
generated
|
|
@ -184,6 +184,7 @@ struct ast_state {
|
|||
PyObject *conversion;
|
||||
PyObject *ctx;
|
||||
PyObject *decorator_list;
|
||||
PyObject *default_value;
|
||||
PyObject *defaults;
|
||||
PyObject *elt;
|
||||
PyObject *elts;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,9 @@
|
|||
#define INTRINSIC_TYPEVAR_WITH_BOUND 2
|
||||
#define INTRINSIC_TYPEVAR_WITH_CONSTRAINTS 3
|
||||
#define INTRINSIC_SET_FUNCTION_TYPE_PARAMS 4
|
||||
#define INTRINSIC_SET_TYPEPARAM_DEFAULT 5
|
||||
|
||||
#define MAX_INTRINSIC_2 4
|
||||
#define MAX_INTRINSIC_2 5
|
||||
|
||||
typedef PyObject *(*intrinsic_func1)(PyThreadState* tstate, PyObject *value);
|
||||
typedef PyObject *(*intrinsic_func2)(PyThreadState* tstate, PyObject *value1, PyObject *value2);
|
||||
|
|
|
|||
|
|
@ -13,10 +13,12 @@ extern PyObject *_Py_make_paramspec(PyThreadState *, PyObject *);
|
|||
extern PyObject *_Py_make_typevartuple(PyThreadState *, PyObject *);
|
||||
extern PyObject *_Py_make_typealias(PyThreadState *, PyObject *);
|
||||
extern PyObject *_Py_subscript_generic(PyThreadState *, PyObject *);
|
||||
extern PyObject *_Py_set_typeparam_default(PyThreadState *, PyObject *, PyObject *);
|
||||
extern int _Py_initialize_generic(PyInterpreterState *);
|
||||
extern void _Py_clear_generic_types(PyInterpreterState *);
|
||||
|
||||
extern PyTypeObject _PyTypeAlias_Type;
|
||||
extern PyObject _Py_NoDefaultStruct;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue