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

Support for data classes/NamedTuples #205

Open
khatchad opened this issue Jul 11, 2024 · 1 comment
Open

Support for data classes/NamedTuples #205

khatchad opened this issue Jul 11, 2024 · 1 comment
Labels
enhancement New feature or request jython parsing

Comments

@khatchad
Copy link
Collaborator

We currently hit a parsing error when encountering a "data class" (introduced in Python 3.7). Here's an example:

https://github.com/kyzhouhzau/NLPGNN/blob/b9ecec2c6df1b3e40a54511366dcb6085cf90c34/nlpgnn/models/TextGCN2019.py#L12-L16

We're getting a front-end parsing error for this. Most likely, it would require a Jython change. To get more info, I filed jython/jython#339.

@khatchad khatchad added enhancement New feature or request parsing jython labels Jul 11, 2024
@khatchad khatchad changed the title Parsing data classes Support for data classes/NamedTuples Jul 11, 2024
@khatchad
Copy link
Collaborator Author

Actually, this is an example of a NamedTuple, which has a similar syntax.

khatchad added a commit to ponder-lab/ML that referenced this issue Jul 11, 2024
khatchad added a commit that referenced this issue Jul 12, 2024
Let's see if we can still go through (similar to
[b3c28a8](#125)).

## Differences
1. Log a warning instead of throwing an exception, which stops the
module from processing. We are already doing this further up the stack
anyway:
https://github.com/wala/ML/blob/ef1cca799d7726bfc70cec7b838ebeec2516d5e4/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/client/PythonAnalysisEngine.java#L159-L166
2. Continue to convert to CAst despite the parsing error coming out of
Jython. This is a workaround for #205.
I think this should be OK (best-effort) as I don't see it contributing
to any soundness issues. And, from what I am seeing in the
[logs](https://github.com/ponder-lab/ML/actions/runs/9897547494/job/27342295209#step:12:32780),
the parsing errors are "mild."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request jython parsing
Projects
None yet
Development

No branches or pull requests

1 participant