summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2020-01-05 01:57:21 (GMT)
committerPablo Galindo <Pablogsal@gmail.com>2020-01-05 01:57:21 (GMT)
commitec007cb43faf5f33d06efbc28152c7fdcb2edb9c (patch)
tree4a5ee08f0316fdfca2910d9a869cced9b8fd5b07 /Lib
parent7dc72b8d4f2c9d1eed20f314fd6425eab66cbc89 (diff)
downloadcpython-ec007cb43faf5f33d06efbc28152c7fdcb2edb9c.zip
cpython-ec007cb43faf5f33d06efbc28152c7fdcb2edb9c.tar.gz
cpython-ec007cb43faf5f33d06efbc28152c7fdcb2edb9c.tar.bz2
Fix SystemError when nested function has annotation on positional-only argument (GH-17826)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_positional_only_arg.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_positional_only_arg.py b/Lib/test/test_positional_only_arg.py
index 59b0b8f..63dee7c 100644
--- a/Lib/test/test_positional_only_arg.py
+++ b/Lib/test/test_positional_only_arg.py
@@ -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()