New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type Annotation of nested function with positional only arguments triggers SystemError #83396
Comments
def f():
def g(arg: int, /):
pass
f() $ python3.9 t2.py
Traceback (most recent call last):
File "/home/asottile/workspace/t2.py", line 5, in <module>
f()
File "/home/asottile/workspace/t2.py", line 2, in f
def g(arg: int, /):
SystemError: no locals when loading 'int' Originally from this StackOverflow post: https://stackoverflow.com/q/59594494/812183 |
Looks as though annotations are using
t3.py is the same as t2.py but without positional-only arguments |
this triggers an assertion when run with debug enabled: $ gdb ./python
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./python...done.
warning: File "/home/asottile/workspace/cpython/python-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path /home/asottile/workspace/cpython/python-gdb.py
line to your configuration file "/home/asottile/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/asottile/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
(gdb) run t2.py
Starting program: /home/asottile/workspace/cpython/python t2.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
python: Python/compile.c:3545: compiler_nameop: Assertion `scope || PyUnicode_READ_CHAR(name, 0) == '_'' failed. Program received signal SIGABRT, Aborted. |
Thanks, Anthony, for the quick fix and the investigation! :) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: