Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2508,6 +2508,16 @@ def test_state_func_docstring_only_one_param_template(self):
"""
self.expect_failure(block, err, lineno=7)

def test_kind_defining_class(self):
function = self.parse_function("""
module m
class m.C "PyObject *" ""
m.C.meth
cls: defining_class
""", signatures_in_block=3, function_index=2)
p = function.parameters['cls']
self.assertEqual(p.kind, inspect.Parameter.POSITIONAL_ONLY)


class ClinicExternalTest(TestCase):
maxDiff = None
Expand Down
8 changes: 4 additions & 4 deletions Modules/_sqlite/clinic/connection.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Modules/clinic/_testclinic.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Tools/clinic/libclinic/dsl_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,7 @@ def bad_node(self, node: ast.AST) -> None:
fail("A 'defining_class' parameter cannot have a default value.")
if self.group:
fail("A 'defining_class' parameter cannot be in an optional group.")
kind = inspect.Parameter.POSITIONAL_ONLY
else:
fail("A 'defining_class' parameter, if specified, must either "
"be the first thing in the parameter block, or come just "
Expand Down