File tree Expand file tree Collapse file tree
py-demo/bindings/src/modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ run_stubgen() {
6161 ${NUMPY_FORMAT} \
6262 --ignore-invalid-expressions=" \(anonymous namespace\)::(Enum|Unbound)|<demo\._bindings\.flawed_bindings\..*" \
6363 --enum-class-locations=" ConsoleForegroundColor:demo._bindings.enum" \
64+ --enum-class-locations=" NativeColor:demo._bindings.enum" \
6465 --print-value-comments \
6566 --print-safe-value-reprs=" Foo\(\d+\)" \
6667 --exit-code
Original file line number Diff line number Diff line change @@ -35,5 +35,13 @@ void bind_enum_module(py::module&&m) {
3535 .value (" Red" , NativeColor::Red)
3636 .value (" Blue" , NativeColor::Blue)
3737 .finalize ();
38+
39+ // Regression: https://github.com/pybind/pybind11-stubgen/issues/304
40+ // Defaults referring to a py::native_enum must not be rendered in a form
41+ // that triggers a parent-package lookup at stub import time.
42+ m.def (
43+ " accept_defaulted_native_enum" ,
44+ [](const NativeColor &color) {},
45+ py::arg (" color" ) = NativeColor::Red);
3846#endif
3947}
You can’t perform that action at this time.
0 commit comments