mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
Fix SystemError when nested function has annotation on positional-only argument (GH-17826)
This commit is contained in:
parent
7dc72b8d4f
commit
ec007cb43f
3 changed files with 11 additions and 0 deletions
|
@ -15,6 +15,10 @@ def global_pos_only_and_normal(a, /, b):
|
|||
def global_pos_only_defaults(a=1, /, b=2):
|
||||
return a, b
|
||||
|
||||
def global_inner_has_pos_only():
|
||||
def f(x: int, /): ...
|
||||
return f
|
||||
|
||||
|
||||
class PositionalOnlyTestCase(unittest.TestCase):
|
||||
|
||||
|
@ -412,6 +416,9 @@ class PositionalOnlyTestCase(unittest.TestCase):
|
|||
|
||||
self.assertEqual(C().method(), sentinel)
|
||||
|
||||
def test_annotations(self):
|
||||
assert global_inner_has_pos_only().__annotations__ == {'x': int}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue