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

Decorated functions specifying a PYTHONPATH don't show up in the call graph #198

Open
khatchad opened this issue Jun 14, 2024 · 1 comment · Fixed by ponder-lab/ML#107
Open
Labels
bug Something isn't working decorators help wanted Extra attention is needed PYTHONPATH

Comments

@khatchad
Copy link
Collaborator

Decorated functions that are part of a PYTHONPATH, i.e., it's name is qualified with a directory path, don't show up in the call graph.

For example, suppose we have the following:

https://github.com/ponder-lab/ML/blob/6974735c51fd827cdfef4d7a58fa7442a2a615c4/com.ibm.wala.cast.python.test/data/proj49/src/test_module10.py#L3-L9

Further suppose that the above file is under the src directory. The name of the about function is then Lscript src/test_module10.py/test_dummy. Somehow, when functions have names under directories like src, they are not getting captured in the closure provided by the decorator summary:

<class name="pytest" allocatable="true">
<method name="import" static="true" descriptor="()Lpytest;">
<new def="x" class="Lpytest" />
<new def="mark" class="Lobject" />
<putfield class="LRoot" field="mark" fieldType="LRoot" ref="x" value="mark" />
<new def="parametrize" class="Lpytest/class/parametrize" />
<putfield class="LRoot" field="parametrize" fieldType="LRoot" ref="mark" value="parametrize" />
<new def="skip" class="Lpytest/class/skip" />
<putfield class="LRoot" field="skip" fieldType="LRoot" ref="mark" value="skip" />
<new def="skipif" class="Lpytest/class/skipif" />
<putfield class="LRoot" field="skipif" fieldType="LRoot" ref="mark" value="skipif" />
<return value="x" />
</method>
</class>
<package name="pytest/class">
<class name="Parametrize" allocatable="true">
<method name="do" descriptor="()LRoot;" numArgs="2" paramNames="self test">
<putfield class="LRoot" field="params" fieldType="LRoot" ref="test" value="self" />
<return value="test" />
</method>
</class>
<class name="parametrize" allocatable="true">
<method name="do" descriptor="()LRoot;" numArgs="4" paramNames="self params values extra">
<new def="closure" class="Lpytest/class/Parametrize" />
<putfield class="LRoot" field="test" fieldType="LRoot" ref="closure" value="self" />
<putfield class="LRoot" field="params" fieldType="LRoot" ref="closure" value="params" />
<putfield class="LRoot" field="values" fieldType="LRoot" ref="closure" value="values" />
<return value="closure" />
</method>
</class>

@khatchad khatchad added bug Something isn't working decorators help wanted Extra attention is needed PYTHONPATH labels Jun 14, 2024
@khatchad khatchad linked a pull request Jun 14, 2024 that will close this issue
khatchad added a commit to ponder-lab/ML that referenced this issue Jun 14, 2024
khatchad added a commit to ponder-lab/ML that referenced this issue Jun 14, 2024
@khatchad khatchad reopened this Jun 14, 2024
khatchad added a commit to ponder-lab/ML that referenced this issue Jun 17, 2024
We were missing the import statement. However, this doesn't work on our
benchmarks, which makes me think that the import statement statement may
be missing there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working decorators help wanted Extra attention is needed PYTHONPATH
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant