google-research / python-graphs

A static analysis library for computing graph representations of Python programs suitable for use with graph neural networks.
Apache License 2.0
325 stars 39 forks source link

KeyError when trying to get program_graph #9

Open ppashakhanloo opened 2 years ago

ppashakhanloo commented 2 years ago

When I try to create a program graph, I encounter a KeyError. If I remove all the and and or expressions from the python file (buggy.py) the error does not occur.

This is how I use the library:

graph = program_graph.get_program_graph(code)
program_graph_graphviz.render(graph, path='source.png')

where code is simply the code in the attached file buggy.py.txt.

I have also attached the log file log.txt.

buggy.py.txt

log.txt

More information: python 3.9.5 commit head=44c15b92197f374c3550353ff827997ef1c1d857 gast 0.5.3

dbieber commented 1 year ago

Thanks for opening the issue! The introduction of unparser_patch in https://github.com/google-research/python-graphs/pull/15/ should resolve this. This will be included by default in the next release.

TJSun009 commented 1 year ago

Hi. Is this release still in progress? I'm waiting on it for a project I'm working on. Thanks.