Skip to content

gh-105373: Remove PyArg_Parse() deprecation #105394

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

Merged
merged 2 commits into from
Jun 13, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 6, 2023

There is no plan to deprecate PyArg_Parse().

The deprecation was added as a comment in the C API documentation in 2007 by commit 85eb8c1.


📚 Documentation preview 📚: https://cpython-previews--105394.org.readthedocs.build/

@vstinner
Copy link
Member Author

vstinner commented Jun 6, 2023

@birkenfeld: Hi, do you recall why you considered to deprecated PyArg_Parse() when you documented the bytes() type in 2007?

cc @serhiy-storchaka @pitrou

@methane
Copy link
Member

methane commented Jun 6, 2023

It makes sense because METH_OLDARGS had been deprecated, and removed already.
Having two similar but slightly different unnecessary function confuse users (and other Python implementations.)

@serhiy-storchaka
Copy link
Member

PyArg_Parse() is used with METH_O and can be used for parsing separate arguments in other functions (for example if argument can be parsed as "i" or "s"), because there is no other public API for some format units or it is less convenient. You can find many examples in the CPython code.

I believe that it is a useful function and should remain.

@vstinner
Copy link
Member Author

vstinner commented Jun 6, 2023

Argument Clinic generates PyArg_Parse() calls for some function signatures.

There are around 69 calls to PyArg_Parse() in the CPython code base, included 15 genereated by Argument Clinic.

If we really want to get ride of it, we should be good citizen and start by cleaning our own code base.

But here I agree with @serhiy-storchaka, this function is fine and should be kept.

If there are use cases where others functions are more appropriated, maybe the doc should be enhanced?
https://docs.python.org/dev/c-api/arg.html#c.PyArg_Parse

@methane: What do you think?

@methane
Copy link
Member

methane commented Jun 7, 2023

I had read only the doc. If there are enough use case for PyArg_Parse, the doc should be updated and deprecation comment should be removed.

vstinner added 2 commits June 9, 2023 10:51
There is no plan to deprecate PyArg_Parse().

The deprecation was added as a comment in the C API documentation in
2007 by commit 85eb8c1.
@vstinner vstinner force-pushed the keep_pyarg_parse branch from a4e9a4d to ecee586 Compare June 9, 2023 08:52
@vstinner
Copy link
Member Author

vstinner commented Jun 9, 2023

@methane:

I had read only the doc. If there are enough use case for PyArg_Parse, the doc should be updated and deprecation comment should be removed.

I rewrote PyArg_Parse() documentation. Would you mind to review the updated PR?

@birkenfeld
Copy link
Member

Just to leave my requested feedback, I don't remember anything about this specific function :)

@vstinner vstinner merged commit d0f1afd into python:main Jun 13, 2023
@vstinner vstinner deleted the keep_pyarg_parse branch June 13, 2023 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants