Visitar URL original
Fix docstring of `warnings._deprecated` to show correct `remove` value by sobolevn · Pull Request #105178 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20260612133550/https://github.com/python/cpython/pull/105178
Skip to content
/ cpython Public

Fix docstring of warnings._deprecated to show correct remove value#105178

Merged
AlexWaygood merged 1 commit into
python:mainfrom
sobolevn:warnings-deprecated-typo
Jun 1, 2023
Merged

Fix docstring of warnings._deprecated to show correct remove value#105178
AlexWaygood merged 1 commit into
python:mainfrom
sobolevn:warnings-deprecated-typo

Conversation

@sobolevn

@sobolevn sobolevn commented Jun 1, 2023

Copy link
Copy Markdown
Member

It used to be a string, but actually passing remove=3.11 will give you a TypeError. Example:

>>> import warnings
>>> warnings._deprecated('a', remove='3.11')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/sobolev/Desktop/cpython/Lib/warnings.py", line 524, in _deprecated
    if (_version[:2] > remove) or (_version[:2] == remove and _version[3] != "alpha"):
        ^^^^^^^^^^^^^^^^^^^^^
TypeError: '>' not supported between instances of 'tuple' and 'str'

So, I've changed it to be a tuple intead, as it should be.

I don't think that this PR is worth an issue / news entry.

@sobolevn

sobolevn commented Jun 1, 2023

Copy link
Copy Markdown
Member Author

@CAM-Gerlach would you like to take a look? :)

@AlexWaygood AlexWaygood enabled auto-merge (squash) June 1, 2023 07:42
@AlexWaygood AlexWaygood merged commit 201440e into python:main Jun 1, 2023
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.

3 participants