summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2023-12-19 11:32:28 (GMT)
committerGitHub <noreply@github.com>2023-12-19 11:32:28 (GMT)
commit6a69b80d1b1f3987fcec3300c5dc879c6e965079 (patch)
tree0c463741c4db44d2d8a6510cfd5cdcdfcdac8e9e /Tools
parente51b4009454939e3ee5f1bfaed45ce65689a71b8 (diff)
downloadcpython-6a69b80d1b1f3987fcec3300c5dc879c6e965079.zip
cpython-6a69b80d1b1f3987fcec3300c5dc879c6e965079.tar.gz
cpython-6a69b80d1b1f3987fcec3300c5dc879c6e965079.tar.bz2
gh-112205: Require @getter and @setter to be methods (#113278)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/clinic/clinic.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index a9bf110..87feef1 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -5614,6 +5614,10 @@ class DSLParser:
function_name = fields.pop()
module, cls = self.clinic._module_and_class(fields)
+ if self.kind in {GETTER, SETTER}:
+ if not cls:
+ fail("@getter and @setter must be methods")
+
self.update_function_kind(full_name)
if self.kind is METHOD_INIT and not return_converter:
return_converter = init_return_converter()