Open maldil opened 3 years ago
annotate_ast appears to correctly annotate REQUIRED_PACKAGES
in Python 3.6 but fail to find an annotation in 3.7, which points to a bug in how we're handling bytecode/line number changes between the two versions. In particular, https://github.com/google/pytype/blob/7056acd733ea88eef084c90b6bb8c56d74c7096d/pytype/tools/traces/traces.py#L255-L258 looks extremely suspicious to me.
I observed following behavior in annotate_ast.annotate_source
The AST annotator correctly annotate the type of
_VERSION
asstr
and type ofREQUIRED_PACKAGES
asList[nothing]
in below example.As the next step, I updated the code as below.
It annotates type of
_VERSION
correctly but it does not annotateREQUIRED_PACKAGES
. I checked the AnnotateAstVisitor to find a possible root cause for this behavior. I observed they visit Name nodes. Therefore I believe, it should visit the nodeREQUIRED_PACKAGES
. Any help to debug this error is very much appreciated.Pytype version : 2021.1.8 OS: MacOS