[issue39215] Type Annotation of nested function with positional only arguments triggers SystemError
Anthony Sottile
report at bugs.python.org
Sat Jan 4 19:35:43 EST 2020
Anthony Sottile <asottile at umich.edu> added the comment:
Looks as though annotations are using `LOAD_NAME` when they should probably use `LOAD_GLOBAL`?
```
$ diff -u <(python3.9 -m dis t2.py | sed 's/0x[a-f0-9]*/0xdeadbeef/g;s/t2\.py/FILENAME/g') <(python3.9 -m dis t3.py | sed 's/0x[a-f0-9]*/0xdeadbeef/g;s/t3\.py/FILENAME/g')
--- /dev/fd/63 2020-01-04 16:34:27.372004436 -0800
+++ /dev/fd/62 2020-01-04 16:34:27.372004436 -0800
@@ -10,7 +10,7 @@
16 RETURN_VALUE
Disassembly of <code object f at 0xdeadbeef, file "FILENAME", line 1>:
- 2 0 LOAD_NAME 0 (int)
+ 2 0 LOAD_GLOBAL 0 (int)
2 LOAD_CONST 1 (('arg',))
4 BUILD_CONST_KEY_MAP 1
6 LOAD_CONST 2 (<code object g at 0xdeadbeef, file "FILENAME", line 2>)
```
t3.py is the same as t2.py but without positional-only arguments
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39215>
_______________________________________
More information about the Python-bugs-list
mailing list