gh-112205: Support @getter annotation from AC by corona10 · Pull Request #112396 · python/cpython · GitHub
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
21 changes: 21 additions & 0 deletions Lib/test/clinic.test.c
26 changes: 17 additions & 9 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ class C "void *" ""
C.__init__ = C.meth
[clinic start generated code]*/
"""
err = "'__init__' must be a normal method, not a class or static method"
err = "'__init__' must be a normal method; got 'FunctionKind.CLASS_METHOD'!"
self.expect_failure(block, err, lineno=8)

def test_validate_cloned_new(self):
Expand Down Expand Up @@ -2180,14 +2180,22 @@ class Foo "" ""
self.expect_failure(block, err, lineno=2)

def test_init_must_be_a_normal_method(self):
err = "'__init__' must be a normal method, not a class or static method!"
block = """
module foo
class Foo "" ""
@classmethod
Foo.__init__
"""
self.expect_failure(block, err, lineno=3)
err_template = "'__init__' must be a normal method; got 'FunctionKind.{}'!"
annotations = {
"@classmethod": "CLASS_METHOD",
"@staticmethod": "STATIC_METHOD",
"@getter": "GETTER",
}
for annotation, invalid_kind in annotations.items():
with self.subTest(annotation=annotation, invalid_kind=invalid_kind):
block = f"""
module foo
class Foo "" ""
{annotation}
Foo.__init__
"""
expected_error = err_template.format(invalid_kind)
self.expect_failure(block, expected_error, lineno=3)

def test_duplicate_coexist(self):
err = "Called @coexist twice"
Expand Down
81 changes: 33 additions & 48 deletions Modules/_io/bufferedio.c
56 changes: 55 additions & 1 deletion Modules/_io/clinic/bufferedio.c.h

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

Loading