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

gh-121277: Raise nice error on next as second argument to deprecated-removed #124623

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

encukou
Copy link
Member

@encukou encukou commented Sep 26, 2024

Using next as the second argument doesn't make sense, but users should get a nicer message than ValueError: invalid literal for int() -- especially since Sphinx hides the traceback by default.


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

Copy link
Member

@ezio-melotti ezio-melotti left a comment

Choose a reason for hiding this comment

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

I left a suggestion in case you want to be more explicit, but otherwise your version works too.

Comment on lines +291 to +293
if version_removed == 'next':
raise ValueError(
'deprecated-removed:: second argument cannot be `next`')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if version_removed == 'next':
raise ValueError(
'deprecated-removed:: second argument cannot be `next`')
if version_removed == 'next':
raise ValueError(
'deprecated-removed:: second argument should be the version in which '
'the API will be removed, and cannot be `next`')

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! But I do think it's too long, and I hope anyone who adds deprecated-removed:: already knows what the args are. If they need this error to find that out, something's very wrong :)

@encukou encukou merged commit e349f73 into python:main Sep 27, 2024
28 checks passed
@encukou encukou deleted the deprecated-removed-next branch September 27, 2024 23:02
encukou added a commit to encukou/cpython that referenced this pull request Sep 27, 2024
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.

2 participants