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
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
Update mypy/checker.py
Co-Authored-By: Ivan Levkivskyi <levkivskyi@gmail.com>
  • Loading branch information
gantsevdenis and ilevkivskyi authored Sep 6, 2019
commit 012b81764891b428bfdea3a065174ae0dc0a6056
2 changes: 1 addition & 1 deletion mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,7 @@ def check_init_subclass(self, defn: ClassDef) -> None:
6 pass
7 Child()

Base.__init_subclass__(thing=5) is called at line 4. This is what we simulate here
Base.__init_subclass__(thing=5) is called at line 4. This is what we simulate here.
Child.__init_subclass__ is never called
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the docstring! Normally we use this style:

"""Short one line summary.

The rest of the description after empty line.
"""

The summary in your case may be Check that keywords in a class definition are valid arguments for __init_subclass__().

"""
typ = defn.info
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