-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
TypeVars in some generic functions can go unsolved, resulting in an Any
in the evaluated type
#7928
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
Closed
18 tasks done
Labels
priority: high
This issue is more important than most
Comments
JelleZijlstra
added a commit
that referenced
this issue
May 23, 2022
AlexWaygood
pushed a commit
that referenced
this issue
May 23, 2022
Thanks, that's very helpful! We should enable that check when it's available and we've fixed the issues. |
Thanks Eric! I added a checklist to your comment so we can track the remaining work. |
JelleZijlstra
added a commit
to JelleZijlstra/typeshed
that referenced
this issue
May 24, 2022
Fixes python#7922, part of python#7928. Also discovered an apparent CPython bug in the process: python/cpython#93157
JelleZijlstra
added a commit
to JelleZijlstra/typeshed
that referenced
this issue
May 24, 2022
hauntsaninja
pushed a commit
that referenced
this issue
May 24, 2022
AlexWaygood
added a commit
that referenced
this issue
May 24, 2022
JelleZijlstra
pushed a commit
that referenced
this issue
May 24, 2022
AlexWaygood
added a commit
that referenced
this issue
May 24, 2022
#7928 `dict()` and `list()` just return empty dictionaries and lists (respectively) if no arguments are supplied: ```python >>> from multiprocessing.managers import SyncManager >>> with SyncManager() as s: ... print(s.dict()) ... {} ```
This was referenced May 24, 2022
JelleZijlstra
added a commit
that referenced
this issue
May 25, 2022
JelleZijlstra
added a commit
that referenced
this issue
May 25, 2022
JelleZijlstra
added a commit
that referenced
this issue
May 25, 2022
JelleZijlstra
added a commit
that referenced
this issue
May 25, 2022
JelleZijlstra
added a commit
that referenced
this issue
May 25, 2022
The first overload covers the case where `new` is not given. Part of #7928
hauntsaninja
pushed a commit
that referenced
this issue
May 25, 2022
AlexWaygood
pushed a commit
that referenced
this issue
May 25, 2022
AlexWaygood
pushed a commit
that referenced
this issue
May 25, 2022
The first overload covers the case where `new` is not given. Part of #7928
AlexWaygood
pushed a commit
that referenced
this issue
May 25, 2022
…tructors (#7944) See microsoft/pyright#3501 (comment) Related to #7928
JelleZijlstra
pushed a commit
that referenced
this issue
May 26, 2022
AlexWaygood
pushed a commit
that referenced
this issue
May 26, 2022
JelleZijlstra
added a commit
to JelleZijlstra/typeshed
that referenced
this issue
May 27, 2022
Fixes an entry from python#7928 along with a number of other improvements. I went off the C code: https://github.com/psycopg/psycopg2/blob/master/psycopg/connection_type.c
JelleZijlstra
added a commit
that referenced
this issue
Jun 3, 2022
Fixes an entry from #7928 along with a number of other improvements. I went off the C code: https://github.com/psycopg/psycopg2/blob/master/psycopg/connection_type.c
This was referenced Jun 14, 2022
Well that was a marathon, but we got there eventually :) |
Well done! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pyright users have recently reported a couple of issues where they received an
Unknown
(i.e. an implicitAny
) type when evaluating a call expression. These problems were both related to a case where a TypeVar was used to annotate a parameter with a default argument, but the caller didn't provide an argument for that parameter and relied on the default. This left the TypeVar unsolved.Here's an example from the pyright issue tracker.
@JelleZijlstra suggested that pyright add a check for this condition. I've enhanced the
reportInvalidTypeVarUse
check to detect and report this case. See this issue for details.The new check identifies 10 cases in the stdlib typeshed stubs and 27 cases in third-party stubs. Jelle asked that I create this issue with the full list, which I have pasted below.
fileinput.input()
#7922)tempfile
: FixTypeVar
usage #7939)multiprocessing.managers
: fixTypeVar
usage #7938)TypeVar
s inbeautifulsoup
andSQLAlchemy
#8087)mypy_extensions
: fixTypeVar
usage #7937)redis
: fix more unconstrainedTypeVar
s #8084cachetools
: Fix invalidTypeVar
usage #8073)TypeVar
usages #8074)The text was updated successfully, but these errors were encountered: