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

bpo-40334: Make the PyPegen* and PyParser* APIs more consistent #19839

Merged
merged 2 commits into from
May 1, 2020

Conversation

lysnikolaou
Copy link
Member

@lysnikolaou lysnikolaou commented May 1, 2020

This PR tries to make both APIs more consistent by doing the following:

  • Remove the PyPegen_CodeObjectFrom* functions, which weren't used
    and will probably not be needed. Functions like
    Py_CompileStringObject can be used instead.
  • Include a const char *filename parameter in PyPegen_ASTFromString.
  • Rename PyPegen_ASTFromFile to PyPegen_ASTFromFilename, because
    its signature is not the same with PyParser_ASTFromFile.

Closes we-like-parsers#104.

https://bugs.python.org/issue40334

This PR tries to make both APIs more consistent by doing the following:
- Remove the `PyPegen_CodeObjectFrom*` functions, which weren't used
  and will probably not be needed. Functions like
  `Py_CompileStringObject` can be used instead.
- Include a `const char *filename` parameter in `PyPegen_ASTFromString`.
- Rename `PyPegen_ASTFromFile` to `PyPegen_ASTFromFilename`, because
  its signature is not the same with `PyParser_ASTFromFile`.

Closes #we-like-parsers#104.
@pablogsal
Copy link
Member

+37 −111

Exquisite 👌

@lysnikolaou
Copy link
Member Author

+37 −111

Exquisite 👌

And that's with rewriting all the arguments to appear one per line in pegen_interface.h! 😄

@pablogsal pablogsal merged commit 03b7642 into python:master May 1, 2020
@pablogsal
Copy link
Member

@lysnikolaou Thanks also for adding good commit messages: it makes writing the final commit message much easier :)

@lysnikolaou lysnikolaou deleted the api-consistency branch May 1, 2020 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add 'char *filename' arg to PyParser_ASTFromString()
4 participants