]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-103763: Implement PEP 695 (#103764)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Tue, 16 May 2023 03:36:23 +0000 (20:36 -0700)
committerGitHub <noreply@github.com>
Tue, 16 May 2023 03:36:23 +0000 (20:36 -0700)
commit24d8b88420b81fc60aeb0cbcacef1e72d633824a
tree1b06e157ddc7d1066fd41a28d2c27270ccf2e278
parentfdafdc235e74f2f4fedc1f745bf8b90141daa162
gh-103763: Implement PEP 695 (#103764)

This implements PEP 695, Type Parameter Syntax. It adds support for:

- Generic functions (def func[T](): ...)
- Generic classes (class X[T](): ...)
- Type aliases (type X = ...)
- New scoping when the new syntax is used within a class body
- Compiler and interpreter changes to support the new syntax and scoping rules

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Eric Traut <eric@traut.com>
Co-authored-by: Larry Hastings <larry@hastings.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
56 files changed:
Doc/library/ast.rst
Grammar/python.gram
Include/cpython/funcobject.h
Include/internal/pycore_ast.h
Include/internal/pycore_ast_state.h
Include/internal/pycore_function.h
Include/internal/pycore_global_objects.h
Include/internal/pycore_global_objects_fini_generated.h
Include/internal/pycore_global_strings.h
Include/internal/pycore_intrinsics.h
Include/internal/pycore_opcode.h
Include/internal/pycore_runtime_init_generated.h
Include/internal/pycore_symtable.h
Include/internal/pycore_typevarobject.h [new file with mode: 0644]
Include/internal/pycore_unicodeobject_generated.h
Include/opcode.h
Lib/ast.py
Lib/importlib/_bootstrap_external.py
Lib/keyword.py
Lib/opcode.py
Lib/test/support/__init__.py
Lib/test/test_ast.py
Lib/test/test_keyword.py
Lib/test/test_sys.py
Lib/test/test_type_aliases.py [new file with mode: 0644]
Lib/test/test_type_params.py [new file with mode: 0644]
Lib/test/test_typing.py
Lib/typing.py
Makefile.pre.in
Misc/NEWS.d/next/Core and Builtins/2023-04-25-08-43-11.gh-issue-103763.ZLBZk1.rst [new file with mode: 0644]
Modules/Setup.bootstrap.in
Modules/Setup.stdlib.in
Modules/_typingmodule.c
Objects/clinic/typevarobject.c.h [new file with mode: 0644]
Objects/funcobject.c
Objects/object.c
Objects/typeobject.c
Objects/typevarobject.c [new file with mode: 0644]
Objects/unionobject.c
PCbuild/_freeze_module.vcxproj
PCbuild/pythoncore.vcxproj
PCbuild/pythoncore.vcxproj.filters
Parser/Python.asdl
Parser/action_helpers.c
Parser/parser.c
Python/Python-ast.c
Python/ast.c
Python/ast_opt.c
Python/bytecodes.c
Python/compile.c
Python/generated_cases.c.h
Python/intrinsics.c
Python/opcode_metadata.h
Python/opcode_targets.h
Python/pylifecycle.c
Python/symtable.c