diff options
author | Erlend E. Aasland <erlend@python.org> | 2024-03-01 17:41:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-01 17:41:20 (GMT) |
commit | cc6f807760300b575195bb8e678b82c10e24231c (patch) | |
tree | 2ad4f04c809836d155ac7ba872472760f93f782c /Tools | |
parent | 41baa03d30bc6b8a439ccca42b656d2c50392896 (diff) | |
download | cpython-cc6f807760300b575195bb8e678b82c10e24231c.zip cpython-cc6f807760300b575195bb8e678b82c10e24231c.tar.gz cpython-cc6f807760300b575195bb8e678b82c10e24231c.tar.bz2 |
gh-116171: Argument Clinic: disallow overriding return converter for __init__ methods (#116172)
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/clinic/clinic.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 7906e7c..80da035 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -5092,6 +5092,8 @@ class DSLParser: if forced_converter: if self.kind in {GETTER, SETTER}: fail(f"@{self.kind.name.lower()} method cannot define a return type") + if self.kind is METHOD_INIT: + fail("__init__ methods cannot define a return type") ast_input = f"def x() -> {forced_converter}: pass" try: module_node = ast.parse(ast_input) |