Skip to content
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

peval doesn't propagate constants stored in dicts #1

Open
KOLANICH opened this issue Oct 19, 2022 · 3 comments
Open

peval doesn't propagate constants stored in dicts #1

KOLANICH opened this issue Oct 19, 2022 · 3 comments

Comments

@KOLANICH
Copy link
Contributor

m = ast.parse("""
dic = {"name": "aa", "version": 10}
setup(name=dic["name"], version=dic["version"])
""")

import peval
from peval.components import fold
r, v = fold(m, {})
print(astor.to_source(r, indent_with='\t',), v)

My use case is automatic safe parsing of metadata from setup.py files. The plan is simple: process the AST with a constant and copy propagation optimizer, then extract the data from setup call.

Also: I had to comment out some asserts in expression.py.

@fjarri
Copy link
Owner

fjarri commented Oct 19, 2022

Unfortunately I haven't had time to work on it in the last couple of years, so the support for Py3.9+ is uncertain, and some features are naturally missing. I can't promise that I will look at it right away, but I will try to find time this or next week.

@KOLANICH
Copy link
Contributor Author

I can't promise that I will look at it right away, but I will try to find time this or next week.

No problem, thanks.

@KOLANICH
Copy link
Contributor Author

Also: python/cpython#98463

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

No branches or pull requests

2 participants