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

Fix typo and broken test cases #102

Merged
merged 4 commits into from
Jun 20, 2024
Merged

Conversation

yf-yang
Copy link
Contributor

@yf-yang yf-yang commented Jun 13, 2024

[Original message] Just out of curiosity, will pegen release a minor version based on the change? I'm fixing the spell check error of a project that inherits ParserGenerator.

Copy link
Contributor

@lysnikolaou lysnikolaou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks a lot @yf-yang! 🎉

We can think about doing a release after we've revived and merged the rest of the open PRs.

@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 14, 2024

Sure. Thank you for your attention.
Do you think I should also submit a PR in cpython repo? It seems too minor.

@lysnikolaou
Copy link
Contributor

It is minor, but you can if you want.

@lysnikolaou
Copy link
Contributor

Could you maybe also look into the test failures here or would you like me to?

@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 18, 2024

Just saw it. I'll take care of it.

@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 18, 2024

Hmm, I am not so sure

Python 3.10

Python 3.10.9 (main, Jan 11 2023, 09:18:20) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.parse("f(**a, *b)")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/admin/miniconda3/lib/python3.10/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    f(**a, *b)
      ^^^
SyntaxError: iterable argument unpacking follows keyword argument unpacking

3.11

Python 3.11.9 (main, Apr 19 2024, 11:44:45) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.parse("f(**a, *b)")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/admin/miniconda3/envs/py311/lib/python3.11/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<unknown>", line 1
    f(**a, *b)
           ^
SyntaxError: iterable argument unpacking follows keyword argument unpacking

@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 18, 2024

tokenize are yielding same results. Will further investigate later.

@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 18, 2024

Maybe related:
python/cpython@3d18034
https://github.com/python/cpython/pull/117444/files

After examine those PR, maybe we just need to update the expected result.

@lysnikolaou
Copy link
Contributor

We probably just need to adjust the column offsets of the SyntaxError depending on version. We do this in other places as well, so should be okay.

@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 18, 2024

Before 3.11, both Python and pegen raises 1,3 ~ 1,6
From 3.11, Python raises 1,8~1,9 pegen raises 1,3 ~ 1,6

If I got it right, we should:

  • Update pegen to follow latest behavior.
  • Correct pos to 1,8 ~ 1,9 and set it to None for Python <= 3.10

Is it right?

@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 18, 2024

Will work on the grammar file later.

@yf-yang yf-yang changed the title Fix typo Fix typo and broken test cases Jun 19, 2024
@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 19, 2024

Ref: python/cpython#117465

Follow latest python 3.12 behavior:

Python 3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024, 10:14:12) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> f(**a, *b)
  File "<stdin>", line 1
    f(**a, *b)
         ^^^^
SyntaxError: iterable argument unpacking follows keyword argument unpacking

Ready to go.

@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 19, 2024

🤨 What's that failure? My local py3.8.19 passes all the tests

@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 20, 2024

@lysnikolaou Why was this one closed? Are we planning to directly sync cpython code sometime later?

@lysnikolaou
Copy link
Contributor

It was closed because of Github autoclosing referenced issues/PRs when there's the word fix in the PR description. Reopening.

@lysnikolaou lysnikolaou reopened this Jun 20, 2024
@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 20, 2024

OK, would you please take a look at the broken 3.8 test suites? I don't quite understand it.

@MatthieuDartiailh
Copy link
Collaborator

Black complains about the formatting of some files. Fixing it may be as simple as running it.

@yf-yang
Copy link
Contributor Author

yf-yang commented Jun 20, 2024

Oh yes, thank you. I wasn't familiar with the ci logs 😅.

@MatthieuDartiailh MatthieuDartiailh merged commit dc7543e into we-like-parsers:main Jun 20, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants