If there is an import statement in an __init__.py file that imports a module in a subpackage, then we'll have two global reads of the same module. The first one is from the one that is imported automatically and the other from the explicit import call. We could reuse the automatic one. Right now, there are two identical ones.
If there is an import statement in an
__init__.py
file that imports a module in a subpackage, then we'll have two global reads of the same module. The first one is from the one that is imported automatically and the other from the explicit import call. We could reuse the automatic one. Right now, there are two identical ones.The potentially redundant read occurs here:
https://github.com/wala/ML/blob/b813bde5f9f9a5df87426192aecb8f0b64b1dcc5/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/ir/PythonCAstToIRTranslator.java#L983-L985
This issue can be exercised by running the following test case:
https://github.com/ponder-lab/ML/blob/d2946f69704a20bb575ea3bdcade2f43bed7f27a/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflow2Model.java#L2611-L2621
That results in the following IR for https://github.com/ponder-lab/ML/blob/d2946f69704a20bb575ea3bdcade2f43bed7f27a/com.ibm.wala.cast.python.test/data/proj51/src/__init__.py:
Note that
v3
andv240
have the same value, though the results seem to differ in the printing (I wonder if that's from the PA?).