diff options
author | Erlend E. Aasland <erlend@python.org> | 2023-12-19 11:32:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-19 11:32:28 (GMT) |
commit | 6a69b80d1b1f3987fcec3300c5dc879c6e965079 (patch) | |
tree | 0c463741c4db44d2d8a6510cfd5cdcdfcdac8e9e /Tools | |
parent | e51b4009454939e3ee5f1bfaed45ce65689a71b8 (diff) | |
download | cpython-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-x | Tools/clinic/clinic.py | 4 |
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() |