gh-117613: Argument Clinic: disallow defining class parameter at module level (#117950)

This commit is contained in:
neonene 2024-04-18 05:43:29 +09:00 • committed by GitHub
parent a4b44d39cd
commit c1d7147c82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -1102,6 +1102,8 @@ class DSLParser:
fail("A 'defining_class' parameter cannot have a default value.")
if self.group:
fail("A 'defining_class' parameter cannot be in an optional group.")
if self.function.cls is None:
fail("A 'defining_class' parameter cannot be defined at module level.")
kind = inspect.Parameter.POSITIONAL_ONLY
else:
fail("A 'defining_class' parameter, if specified, must either "