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

Bug with global and nonlocal in the existing parser #725

Closed
akshanshbhatt opened this issue Jul 2, 2022 · 1 comment · Fixed by #756
Closed

Bug with global and nonlocal in the existing parser #725

akshanshbhatt opened this issue Jul 2, 2022 · 1 comment · Fixed by #756
Labels
Parser Issues or improvements related to parser

Comments

@akshanshbhatt
Copy link
Collaborator

I tried to generate the AST for this code -

cat examples/expr2.py
global a, c

And to my surprise, the new parser was working fine, but the existing parser failed to generate the correct AST.

python3 -m ast examples/expr2.py
Module(
   body=[
      Global(
         names=[
            'a',
            'c'])],
   type_ignores=[])

❯ lpy --show-ast --new-parser examples/expr2.py --tree  #NEW-Module
  |-body=|-Global
  |-names=a c-type_ignores=↧

❯ lpy --show-ast examples/expr2.py --tree  #OLD/EXISTING-Module
  |-body=|-Global
  |-names=-type_ignores=

Similar case with nonlocal.

@Thirumalai-Shaktivel Thirumalai-Shaktivel added the Parser Issues or improvements related to parser label Jul 2, 2022
@Thirumalai-Shaktivel
Copy link
Collaborator

Thanks for opening an issue. Yup, we need to debug this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Parser Issues or improvements related to parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants