Open bdarnell opened 1 year ago
For the record, this is still occurring with language server version 2027.7.1 (Pylance language server 2024.7.1 (pyright version 1.1.369, commit 1168be71) starting
). However, it's moved around a bit. I no longer see it on the import sys
line in tornado/test/runtests.py
. I still see it in other places, including the import of binascii
in httpclient_test.py.
I'm not sure whether this is a useful clue or not, but binascii
is imported four times in this codebase (auth.py
, web.py
, httpclient_test.py
, and web_test.py
), and three of those times are affected by this bug (the one in web.py
is not).
let me take a look
I think I found the issue. thank you for the reporting!
Environment data
Code Snippet
The issue occurs for some but not all stdlib imports within the github.com/tornadoweb/tornado repo. The cause appears to be this
__getattr__
hook in tornado/init.pyhttps://github.com/tornadoweb/tornado/blob/dc56f548fb7edfc6697b100cbbfc422fd9784913/tornado/__init__.py#L63-L67
One import that gives this error is the "import sys" in tornado/test/runtests.py.
Repro Steps
Clone github.com/tornadoweb/tornado, open it in vscode (with python plugins installed with default settings). Open tornado/test/runtests.py and observe the warning reported on the "import sys" line:
Expected behavior
No warning should be emitted.
Actual behavior
A warning is emitted as quoted above.
This is a false positive for multiple reasons:
tornado.*
or relative imports within the tornado package, not this unqualified "import sys"Logs