Skip to content

Fix 7190:__init_subclass__ is not type-checked #7452

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 31 commits into from
Sep 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a709e11
simulate a Call to Base.__init_subclass__
gantsevdenis Sep 3, 2019
dd3df66
added fixture
gantsevdenis Sep 3, 2019
1dfae8c
update existing test; class B would fail at runtime
gantsevdenis Sep 3, 2019
081e19c
added tests
gantsevdenis Sep 3, 2019
145d254
base, not typ
gantsevdenis Sep 3, 2019
bd66bca
flake8
gantsevdenis Sep 3, 2019
1d12de7
trailing space
gantsevdenis Sep 3, 2019
7dccdb7
fix type
gantsevdenis Sep 3, 2019
f5cc79a
added test for metaclass
gantsevdenis Sep 4, 2019
1c62e37
make signature conform to typeshed
gantsevdenis Sep 4, 2019
6729fe8
refactor into a method + check for metaclass + added comments
gantsevdenis Sep 4, 2019
502aa3f
space
gantsevdenis Sep 4, 2019
dfb6551
missing return + annotation
gantsevdenis Sep 4, 2019
b860c3a
Update mypy/checker.py
gantsevdenis Sep 5, 2019
012b817
Update mypy/checker.py
gantsevdenis Sep 6, 2019
a8fcb3e
Update mypy/checker.py
gantsevdenis Sep 6, 2019
ef295b5
Update mypy/checker.py
gantsevdenis Sep 6, 2019
ddc1dce
Update mypy/checker.py
gantsevdenis Sep 6, 2019
2c0c20f
added test with imports
gantsevdenis Sep 6, 2019
67a761b
check for "object" too
gantsevdenis Sep 6, 2019
79208fd
stylistic changes
gantsevdenis Sep 6, 2019
8eb7b8d
added test
gantsevdenis Sep 6, 2019
9a7ab31
simplify logic
gantsevdenis Sep 15, 2019
2281a86
modify test
gantsevdenis Sep 15, 2019
f8f330a
sync typeshed to master
gantsevdenis Sep 15, 2019
0a16c0c
Merge from upstream/master
gantsevdenis Sep 15, 2019
0850dff
flake8
gantsevdenis Sep 15, 2019
798ff33
Update mypy/checker.py
gantsevdenis Sep 21, 2019
6f5bda9
Update mypy/checker.py
gantsevdenis Sep 21, 2019
ab8a6c8
move comment line
gantsevdenis Sep 21, 2019
7da5d11
undo pin move
gantsevdenis Sep 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make signature conform to typeshed
  • Loading branch information
gantsevdenis committed Sep 4, 2019
commit 1c62e37db43ae0e367c5130d4f9401df358d29f5
4 changes: 2 additions & 2 deletions test-data/unit/check-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -6162,7 +6162,7 @@ class Base:
default_name: str

def __init_subclass__(cls, default_name: str, **kwargs):
super().__init_subclass__(**kwargs)
super().__init_subclass__()
cls.default_name = default_name
return

Expand All @@ -6176,7 +6176,7 @@ class Base:
thing: int

def __init_subclass__(cls, default_name: str, thing:int, **kwargs):
super().__init_subclass__(**kwargs)
super().__init_subclass__()
cls.default_name = default_name
return

Expand Down
5 changes: 2 additions & 3 deletions test-data/unit/fixtures/object_with_init_subclass.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import Sequence, Iterator, TypeVar, Mapping, Iterable, Optional, Union, overload, Tuple, Generic


class object:
def __init__(self) -> None: pass
def __init_subclass__(cls, **kwargs) -> None: pass
def __init__(self) -> None: ...
def __init_subclass__(cls) -> None: ...

T = TypeVar('T')
KT = TypeVar('KT')
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy