summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2024-03-01 17:41:20 (GMT)
committerGitHub <noreply@github.com>2024-03-01 17:41:20 (GMT)
commitcc6f807760300b575195bb8e678b82c10e24231c (patch)
tree2ad4f04c809836d155ac7ba872472760f93f782c /Tools
parent41baa03d30bc6b8a439ccca42b656d2c50392896 (diff)
downloadcpython-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-xTools/clinic/clinic.py2
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)