-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
"unresolved placeholder type None" on mypy 1.0.0 #14631
Comments
I have the same problem.. |
Thanks for the report! Confirming the crash and the regression from 0.991 And thank you for the minimal repro here! |
@hauntsaninja : Thanks for the quick fix!! |
I just upgraded to mypy 1.0.0 here and I'm now getting an error running mypy on the AsyncSSH package with the definition of the _ConnectionFactory type that triggered this issue: async def _open_proxy(
loop: asyncio.AbstractEventLoop, command: Sequence[str],
conn_factory: _ConnectionFactory[_Conn]) -> _Conn: The relevant definitions are: _Conn = TypeVar('_Conn', 'SSHClientConnection', 'SSHServerConnection')
_ConnectionFactory = Callable[[], _Conn] The SSHClientConnection and SSHServerConnection classes are declared later in this module. The specific error is: asyncssh/connection.py:272: error: Invalid type argument value for "_ConnectionFactory" [type-var] Any idea how I avoid this error? It only shows up in this one place, while other similar references to _ConnectionFactory[_Conn] are working fine. For instance, the following doesn't give an error: async def _connect(options: 'SSHConnectionOptions',
loop: asyncio.AbstractEventLoop, flags: int,
sock: Optional[socket.socket],
conn_factory: _ConnectionFactory[_Conn], msg: str) -> _Conn: My environment:
|
Hello, we are still seeing this error with
Unfortunately, the code base is large and proprietary, so I can't supply the code. I tried to figure out which exactly causes it, but was unable to narrow it down to anything concrete. Is there anything I can set to have mypy output more details? I tried |
I don't know if it will help or not, but here's how I worked around this problem in AsyncSSH after upgrading to mypy 1.0.0: Basically, I eliminated a type definition of the form |
Hi @Tasssadar , are you able to resolve your issue yet? Just a shot in the dark as I am currently experiencing the same issue and error, perhaps you installed pandas-stubs and it is causing your codebase with pandas to face this issue. For me, that was the problem and I have raised an issue with pandas-stubs separately. Hope this helps! |
I haven't seen this in a while, so probably fixed in one of the MyPy updates that arrived in the meantime. But it's definitely not a pandas-stubs issue, this is mypy hard-crashing, that is never the right behavior - at the very least, it must produce some helpful message about what is wrong. |
Bug Report
There is a bug that makes it impossible to typecheck any Python application/library that has an import of the asyncssh package. However, typechecking asyncssh directly doesn't result in this bug. (See below, for a sort of reproducer).
The error looks like this:
To Reproduce
Install
asyncssh
, then create a Python file with only this import and typecheck that file.Or:
mypy -c 'import asyncssh'
I tried to reduce the code surface as much as possible. Removing every file within asyncssh, except
py.typed
and__init__.py
, and then write the following in__init__.py
:With the above snippet it still happens.
Your Environment
--strict
mypy.ini
(and other config files): /cc: @ronf
The text was updated successfully, but these errors were encountered: