You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our case, MyEnum is a C++ enum class exposed to Python via pybind11. The type annotation seemed to be correct, because at runtime, __members__ does exist.
In mypy version 0.950 the __members__ field is no longer annotated, which means that existing value code no longer type checks properly.
Bug Report
In mypy version 0.942, the stub generator used to create
__members__
fields like:In our case,
MyEnum
is a C++enum class
exposed to Python via pybind11. The type annotation seemed to be correct, because at runtime,__members__
does exist.In mypy version 0.950 the
__members__
field is no longer annotated, which means that existing value code no longer type checks properly.To Reproduce
native_enum_test.cpp
with content:$ c++ -O3 -Wall -shared -std=c++17 -fPIC $(python3 -m pybind11 --includes) native_enum_test.cpp -o native_enum_test.so
Expected Behavior
As far as I can see,
__members__
should be generated by the stub generator.Check against the previous mypy version:
pip install mypy==0.942
and re-running the stub generator produces:Generator output mypy 0.942
Actual Behavior
__members__
is missing in the stub generator output.Generator output mypy 0.950
Your Environment
mypy.ini
(and other config files): not relevant, this is about the stub generatorThe text was updated successfully, but these errors were encountered: