Repository navigation
remove Optional from type of __slots__ - #2128
Merged
Merged
Conversation
JelleZijlstra
added a commit
to JelleZijlstra/mypy
that referenced
this pull request
May 14, 2018
Needed after python/typeshed#2128; this will fail tests until the typeshed change is merged.
emmatyping
suggested changes
May 19, 2018
| __class__ = ... # type: type | ||
| __dict__ = ... # type: Dict[str, Any] | ||
| __slots__ = ... # type: Optional[Union[str, unicode, Iterable[Union[str, unicode]]]] | ||
| __slots__ = ... # type: Union[str, unicode, Iterable[Union[str, unicode]]] |
Member
There was a problem hiding this comment.
Slots can be None in Python 2, so this isn't quite accurate.
Member
Author
There was a problem hiding this comment.
I don't think so.
$ python2.7
Python 2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class A(object):
... __slots__ = None
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Error when calling the metaclass bases
'NoneType' object is not iterable
(That's a new-style class. Old-style classes do allow __slots__ = None, but that's because they allow anything to be set in __slots__ and ignore the value.)
Member
There was a problem hiding this comment.
Ah, you are right. I didn't know old style classes don't use slots.
emmatyping
approved these changes
May 19, 2018
Member
|
OK, stand by for more test failures until I merge the companion PR in mypy, python/mypy#5046. |
Member
|
Oh, this also broke because the two copies are now out of sync. Will fix. |
gvanrossum
pushed a commit
that referenced
this pull request
Jun 11, 2018
gvanrossum
added a commit
that referenced
this pull request
Jun 11, 2018
gvanrossum
pushed a commit
to gvanrossum/mypy
that referenced
this pull request
Jun 11, 2018
Needed after python/typeshed#2128; this will fail tests until the typeshed change is merged.
yedpodtrzitko
pushed a commit
to yedpodtrzitko/typeshed
that referenced
this pull request
Jan 23, 2019
yedpodtrzitko
pushed a commit
to yedpodtrzitko/typeshed
that referenced
this pull request
Jan 23, 2019
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1853
This is going to fail mypy_selftest in Travis because it needs a concurrent change to mypy. I'll send out a mypy PR for doing that.