-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
gh-128772: Fix - warnings.deprecated doesn't work well with pydoc #128781
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
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
20f1fb4
store __module__ into a variable and restore after __new__ method cre…
srinivasreddy 75c1663
Merge branch 'main' into gh_128772
srinivasreddy 9d0e70f
Preserve __module__
srinivasreddy 86924f2
Reintroduce space
srinivasreddy a7b4e83
Merge branch 'main' into gh_128772
srinivasreddy aab2f5b
Merge branch 'main' into gh_128772
srinivasreddy 382299e
Add test case for help(....) function
srinivasreddy 5b879a3
Fix indentation
srinivasreddy 5595a8e
Fix test failure
srinivasreddy 4b3db9e
Update test cases
srinivasreddy 35731f3
Update tests
srinivasreddy eb5cb3b
order imports
srinivasreddy 7be5d8a
Improve test cases
srinivasreddy 4752d38
Improve test case
srinivasreddy 8b54982
Revert the code since it is in wrong place
srinivasreddy 3c2c9d3
Move the test case to here from Lib/idlelib/idle_test/test_warning.py
srinivasreddy d48801e
Add blurb
srinivasreddy 08228dc
Update description
srinivasreddy 09d4fa1
Merge branch 'main' into gh_128772
srinivasreddy 57e01d8
Update Misc/NEWS.d/next/Library/2025-01-17-13-38-12.gh-issue-128772.8…
srinivasreddy 2c0b399
Address review comments
srinivasreddy 0eaefef
Revert the change
srinivasreddy 3edb9b1
Remove creating an instance B()
srinivasreddy 96bab8d
Address review comments. Move the deprecated class to a separate data…
srinivasreddy 84175fc
Fix failure
srinivasreddy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from warnings import deprecated | ||
|
||
@deprecated("Test") | ||
class A: | ||
def __init_subclass__(self, **kwargs): | ||
pass | ||
|
||
class B(A): | ||
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Misc/NEWS.d/next/Library/2025-01-17-13-38-12.gh-issue-128772.8yEVh2.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Make sure the :attr:`~method.__module__` attribute is set on :meth:`~object.__new__` | ||
and :meth:`~object.__init_subclass__` when the :func:`warnings.deprecated` decorator | ||
is applied on classes. |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be that the existing
__module__
is overridden on__new__
and__init_subclass__
here, if it already exists.