-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Logger.getChild subclass compatible typehint #6609
Logger.getChild subclass compatible typehint #6609
Conversation
Co-authored-by: Akuli <akuviljanen17@gmail.com>
This comment has been minimized.
This comment has been minimized.
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.
Thanks! I'll wait for another maintainer to merge this and confirm whether this is a good idea.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Looking at https://github.com/python/cpython/blob/main/Lib/logging/__init__.py#L1750 I don't think this is right. There is no guarantee that |
Ah, I just found python/typing#980 which makes a good argument that this is useful in practice. |
Well, this is a thread I opened today before opening the issue here. I linked this thread also in the issue. #6606 |
It might be good to include a link to the thread in a comment |
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diff from mypy_primer, showing the effect of this PR on open source code: ppb-vector (https://github.com/ppb/ppb-vector)
- File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/__main__.py", line 11, in console_entry
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/__main__.py", line 11, in console_entry
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/main.py", line 87, in main
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/main.py", line 87, in main
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/main.py", line 165, in run_build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/main.py", line 165, in run_build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 179, in build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 179, in build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 254, in _build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 254, in _build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2644, in dispatch
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2644, in dispatch
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2802, in load_graph
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2802, in load_graph
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 1888, in __init__
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 1888, in __init__
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2016, in parse_file
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2016, in parse_file
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 1955, in wrap_context
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 1955, in wrap_context
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2046, in parse_file
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2046, in parse_file
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 788, in parse_file
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 788, in parse_file
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/parse.py", line 25, in parse
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/parse.py", line 25, in parse
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 168, in parse
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 168, in parse
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 329, in visit
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 329, in visit
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 496, in visit_Module
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 496, in visit_Module
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 367, in translate_stmt_list
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 367, in translate_stmt_list
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 329, in visit
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 329, in visit
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 509, in visit_FunctionDef
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 509, in visit_FunctionDef
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 607, in do_func_def
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 607, in do_func_def
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 439, in as_required_block
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 439, in as_required_block
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 367, in translate_stmt_list
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 367, in translate_stmt_list
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 327, in visit
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 327, in visit
pylox (https://github.com/sco1/pylox)
- File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/__main__.py", line 11, in console_entry
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/__main__.py", line 11, in console_entry
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/main.py", line 87, in main
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/main.py", line 87, in main
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/main.py", line 165, in run_build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/main.py", line 165, in run_build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 179, in build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 179, in build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 254, in _build
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 254, in _build
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2644, in dispatch
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2644, in dispatch
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2802, in load_graph
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2802, in load_graph
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 1888, in __init__
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 1888, in __init__
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2016, in parse_file
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2016, in parse_file
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 1955, in wrap_context
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 1955, in wrap_context
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2046, in parse_file
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 2046, in parse_file
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 788, in parse_file
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/build.py", line 788, in parse_file
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/parse.py", line 25, in parse
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/parse.py", line 25, in parse
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 168, in parse
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 168, in parse
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 329, in visit
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 329, in visit
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 496, in visit_Module
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 496, in visit_Module
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 367, in translate_stmt_list
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 367, in translate_stmt_list
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 329, in visit
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 329, in visit
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 729, in visit_ClassDef
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 729, in visit_ClassDef
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 439, in as_required_block
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 439, in as_required_block
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 367, in translate_stmt_list
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 367, in translate_stmt_list
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 329, in visit
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 329, in visit
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 509, in visit_FunctionDef
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 509, in visit_FunctionDef
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 607, in do_func_def
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 607, in do_func_def
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 439, in as_required_block
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 439, in as_required_block
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 367, in translate_stmt_list
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 367, in translate_stmt_list
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 327, in visit
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.10/site-packages/mypy/fastparse.py", line 327, in visit
|
Proposed fix for #6606