-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Fixes #4506: Support Python 3 annotations on fields callables #4508
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 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6013bcb
Fixes #4506: Support Python 3 annotations on fields callables
Alir3z4 fe417aa
Add getargspec to compact
Alir3z4 974b94d
Using getargspec from compat
Alir3z4 610e8ca
Better to check of existence of `signature`
Alir3z4 14c22bc
Coment t o show whihc python version is statement for
Alir3z4 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
Next
Next commit
Fixes #4506: Support Python 3 annotations on fields callables
- Loading branch information
commit 6013bcb42506b9822c43dfe8e3dff5d2762c5185
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.
Great stuff. Let's move this into a
getargspec()function incompat.py, then we'll be good to go.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.
What would the work overhead to use
Signatureinstead ofgetfullargspec?I'm asking because
getfullargspecis deprecated from 3.5 so since we're working on that part, might be good to jump directly to theSignature.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.
Note that I don't want to bother if it's too much work.
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.
@tomchristie Yeah, moving to
compatmakes more sense. Wasn't familiar with the code much. Will do that now.@xordoquy that makes more sense, yeah. I agree
Signaturewould be better, I just implemented it with the method withinspect.Signatureand I'm going to push it.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.
See here in #4505.
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.
@tomchristie - I don't think a
compat.getargspecmakes sense here, assignatureandgetargspecbehave differently and aren't directly interchangeable. Primarily,signaturewill not returnselffor bound methods where asgetargspecwill. I'll push a test case to demonstrate.Uh oh!
There was an error while loading. Please reload this page.
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.
@rpkilby
compat.getargspeconly returns the methodparametersanddefaultsand that's allfields.is_simple_callablecares about and nothing else.If other parts of the application requires something more than that from
compat.getargspecthen modifications can be applied, otherwise the whole backward compatibility should be taken care of infields.is_simple_callableitself, which that was what I did in the first place and @tomchristie suggested the change, In my opinion it keeps the code clean and straight.