stubgen: mangles from _typeshed import Incomplete on Windows
Bug Report
When stubgen creates stubs for a module that imports Incomplete , it then mangles / overcomplicates the import in the generated stub
edit : On Windows
To Reproduce - minimal repro
from _typeshed import Incomplete
def polar(*args, **kwargs) -> Incomplete:
...
running stubgen results in
from _typeshed import Incomplete as Incomplete
def polar(*args, **kwargs) -> Incomplete: ...
Environment
- Mypy version used: 1.7.0
- Mypy command-line flags: - none
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used: 3.11
- OS: Windows_NT x64 10.0.26100
@Josverl hi! I think it's outdated issue
I can prove it still reproduces with stubgen 1.15.0.
@makridenko Why do you think it is outdated ?
@Josverl I've tried to reproduce it with master-branch stubgen and it works fine. I guess we need to wait for release
Perhaps to be clearer
The bug is the 2x Incomplete in Incomplete as Incomplete
Expected
from _typeshed import Incomplete
def polar(*args, **kwargs) -> Incomplete
So the bug is still not resolved.
In master branch everything is working as expected:
Do we have a test case for that?
@sobolevn I can add the test that's in the screenshot above
@sobolevn https://github.com/python/mypy/pull/19253
Ill verify the current state as I can't explain why the behavior is different for @makridenko than for me. Also the previous reported behavior by @makridenko was same as mine, so something changed....
That might also mean that the test case is not covering the all relevant aspects.
Ill report back here.
@sobolevn Im sorry , but i need to report that the issue indeed is not fixed. The same issue still occurs, but appears to be specific to stubgen running on Windows. I did not include that in my initial report, as I assumed that that would not matter.
Is stubgen tested on anything but Ubuntu ? ( there are a lot of tests skipped on Windows)
@Josverl thank you for clarifying this, unfortunately I don't have any windows machine. @sobolevn could you test this?
a few points.
- The tests that was added is part of a suite that is skipped on Windows. ( along with the rest of the suite)
pytest mypy\test\teststubgen.py::StubgenPythonSuite::stubgen.test::testIncompleteReturn
========================================================================= test session starts ==========================================================================
platform win32 -- Python 3.11.9, pytest-8.3.5, pluggy-1.5.0
rootdir: D:\mypython\!-stubtestprojects\mypy_mangle\mypy
configfile: pyproject.toml
plugins: anyio-4.6.0, time-machine-2.16.0
collected 1 item
mypy\test\teststubgen.py s [100%]
========================================================================== 1 skipped in 0.44s ==========================================================================
- When I remove that
skipifguard , the tests passes, but the stubgen behaviour is still incorrect.
Any progress on replication of this issue?