Repository navigation
gh-120381: Fix inspect.ismethoddescriptor() #120383
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
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
dcc561b
gh-120381: Fix inspect.ismethoddescriptor()
zuo 7740b0e
Merge branch 'main' into inspect-ismethoddescriptor-fix
zuo 2dc2168
Fix the blurb
zuo 4f13243
Merge branch 'main' into inspect-ismethoddescriptor-fix
zuo 7fdc95a
Merge branch 'main' into inspect-ismethoddescriptor-fix
zuo 52f579f
Clean up/improve/refactor tests
zuo 57875a7
Refactor
zuo 01178fa
Doc: add `versionchanged`...
zuo 71c3735
Test: added more method/function cases (requested by @eendebakpt)
zuo 2daa16f
Test: added one more method/function case...
zuo 0c7bb3f
Update Doc/library/inspect.rst
zuo 84aed74
A couple of renames
zuo 0390f85
Improve the `versionchanged` description
zuo bcfeeb6
Update Doc/library/inspect.rst
zuo eb4d852
minor reST syntax fix
zuo 8ccb761
Merge branch 'main' into inspect-ismethoddescriptor-fix
ncoghlan 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
Test: added more method/function cases (requested by @eendebakpt)
- Loading branch information
commit 71c3735411f955fbe28e4b71956204bcb8fb06db
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
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.
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.
Frankly, I'd rather prefer to reduce the number of these cases...
I'd keep:
Owner().instance_method(method object – bound to an instance),Owner().class_method(method object – bound to a class),Owner().static_method(just a function object)I'd remove:
functionanda_lambdacompletely – each of them is also just a function object, so they are redundant.When it comes to the ones you proposed, please note that
Owner.instance_methodandOwner.static_methodare also just function objects, andOwner.class_methodis a method object bound to a class (identical to theOwner().class_methodone).This test class should focus on the behavior of
inspect.ismethoddescriptor(). Various ways of obtaining objects of the same type are out of scope of it.(In the first version, I wanted to mimic some elements of the already existing test class
TestIsDataDescriptor. But now I believe that that one should be improved instead – though rather not as a part of this PR).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.
Do you agree with my reasoning, or would you prefer these new cases to be added anyway? Could you please decide, I have no strong feelings about this particular detail. :)
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.
I prefer having all possible cases. One reason is that it shows how robust the
inspectis and for me (at Sphinx), it's quite important to have a robustinspectmodule. So, if there are some possibilities in the future where something could go wrong (hello Murphy), it's better to have a wide coverage.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.
OK, added :)
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.
Thank you! (it also implicitly helps in asserting that a function and a lambda function have the same type)