-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix #3675: safe_infer()
finds ambiguity among function definitions when number of arguments differ
#5409
Fix #3675: safe_infer()
finds ambiguity among function definitions when number of arguments differ
#5409
Conversation
Pull Request Test Coverage Report for Build 1541232939
π - Coveralls |
safe_infer
now finds ambiguity when number of arguments differsafe_infer
now finds ambiguity among function definitions when number of arguments differ
safe_infer
now finds ambiguity among function definitions when number of arguments differsafe_infer()
finds ambiguity among function definitions when number of arguments differ
β¦arguments differ
TemporaryFile may or may not be NamedTemporaryFile depending on system platform, and astroid has no way of knowing this, so abort.
ccb87e0
to
13ebc62
Compare
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.
Nice fix! Two minor comments :)
Co-authored-by: DaniΓ«l van Noord <[email protected]>
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.
With that discussion solved, this is now good to go!
Thanks @jacobtylerwalls, also for pointing to the code that relied on args
being None
!
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 for also making astroid better !
@Pierre-Sassoulas I think this can be merged? Or are we waiting on something? |
I probably thought Marc would want to review, but we can merge, most MR do not have 3 approbations. |
* Add additional isinstance check * Originally added in pylint-dev#5409
* Add additional isinstance check * Originally added in #5409
Type of Changes
Description
Before
safe_infer
might confuse two function definitions having different numbers of arguments.Now
It won't.
But there is an inference problem withUpdate: the wayTemporaryFile
being inferred asNamedTemporaryFile
, which has an extra argument (delete
), so I special-cased it. Is that an Astroid issue?tempfile
defines the nameTemporaryFile
conditionally based on platform means Astroid finds ambiguity.Closes #3675