Revert #893: Avoid setting a Call as a base for classes from six.with_metaclass()
#1622
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.
Steps
Description
#893 intended to fix a false positive for
unused-import
ofsix
in a pattern likeclass Thing(six.with_metaclass(meta, ancestor))
by making thenodes.Call
containingsix.with_metaclass
into a base. Then, this violated assumptions elsewhere, leading to the crash in pylint-dev/pylint#5935.#893 was itself a partial reversion of #841, a fix for #713. #713 is essentially the same issue as pylint-dev/pylint#5935. So what I'm suggesting is that we revert to #841, and then find another way to deal with the
unused-import
in pylint, if at all.(I'd much rather have a false positive than a crash. And the class of false positives is larger than anything to do with
six.with_metaclass
anyway: see pylint-dev/pylint#1630. So we shouldn't treatsix
as more special.)Let's not backport this, to give us time to make a decision about what to do in pylint with pylint-dev/pylint#1630.
Type of Changes
Related Issue
Refs pylint-dev/pylint#5935