-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
command line interface of symtable module is broken #85098
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
Comments
(.venv) (Python 3.10.0a0) [ 1:11ÖS ] [ isidentical@x200:~ ] (.venv) (Python 3.10.0a0) [ 1:11ÖS ] [ isidentical@x200:~ ] It can clearly seen that the initial argument [t.py] is completely ignored, and this script prints out the symtable.py itself. This is because the script uses argv[0] (itself) instead of argv[1] (the first argument). I also find this output quite poor since we don't know what these boolean values are; <symbol 'DEF_LOCAL'> True False The fix I had in my mind is printing all properties instead of 2 boolean values $ ./cpython/cpython/python -m symtable t.py
<symbol 'x'> ==> {'local', 'imported', 'referenced'}
<symbol 'a'> ==> {'local', 'assigned'}
<symbol 'print'> ==> {'referenced', 'global'} |
I also worked on improving the CLI of symtable. I do not remember why I did not finish the work and did not touch the code for 3.5 years. In any case I show it in #109112. |
Example of the output:
It outputs the scope separately from flags. It prints not only top-level symbols, but also symbols in nested namespaces. It also changes the repr of |
After some thought I changed the output formatЖ
Now nested symbol tables are output after symbols and include header with some table related information. It also helps when specify several input files. |
Co-authored-by: Pablo Galindo Salgado <[email protected]>
Co-authored-by: Pablo Galindo Salgado <[email protected]>
Co-authored-by: Pablo Galindo Salgado <[email protected]>
Co-authored-by: Pablo Galindo Salgado <[email protected]>
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:
Linked PRs
The text was updated successfully, but these errors were encountered: