Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

Preloading globals throws NameError #890

Open
patiences opened this issue Aug 2, 2018 · 1 comment
Open

Preloading globals throws NameError #890

patiences opened this issue Aug 2, 2018 · 1 comment

Comments

@patiences
Copy link
Contributor

glbs = globals 
glbs() 

Unexpectedly this throws a NameError: name 'globals' is not defined. But

globals()

is fine.

@patiences
Copy link
Contributor Author

patiences commented Aug 6, 2018

This is a little tricky because globals() and locals() and vars() are implemented on the AST side (see ast.py#visit_Call). If one of globals, locals, or vars is looked up as an attribute and used as a function later, then I'm not sure whether it's possible to do it all on the AST side.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant