GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-105373: Remove PyArg_Parse() deprecation by vstinner · Pull Request #105394 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jun 6, 2023 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

  • Issue: Keep deprecated functions in Python 3.13: remove this deprecation #105373

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner vstinner added the skip news label Jun 6, 2023
@bedevere-bot bedevere-bot added awaiting core review docs Documentation in the Doc dir labels Jun 6, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jun 6, 2023
Keep deprecated functions in Python 3.13: remove this deprecation #105373
Closed
@vstinner

vstinner commented Jun 6, 2023

Copy link
Copy Markdown
Member Author

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

cc @serhiy-storchaka @pitrou

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@methane

methane commented Jun 6, 2023

Copy link
Copy Markdown
Member

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.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka

serhiy-storchaka commented Jun 6, 2023

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka
serhiy-storchaka approved these changes Jun 6, 2023
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jun 6, 2023
@vstinner

vstinner commented Jun 6, 2023

Copy link
Copy Markdown
Member Author

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@methane

methane commented Jun 7, 2023

Copy link
Copy Markdown
Member

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner added 2 commits June 9, 2023 10:51
@vstinner
pythongh-105373: Remove PyArg_Parse() deprecation
2c83e81
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
Update PyArg_Parse() documentation
ecee586
@vstinner
vstinner force-pushed the keep_pyarg_parse branch from a4e9a4d to ecee586 Compare June 9, 2023 08:52
@vstinner

vstinner commented Jun 9, 2023

Copy link
Copy Markdown
Member Author

@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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

methane
methane approved these changes Jun 11, 2023
View reviewed changes
@birkenfeld

birkenfeld commented Jun 11, 2023

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner merged commit d0f1afd into python:main Jun 13, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label 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

Reviewers

@methane methane methane approved these changes
@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@vstinner @methane @serhiy-storchaka @birkenfeld @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.