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
Fixed stubgen parsing generics from C extensions (#8939)
pybind11 is capable of producing type signatures that use generics
(for example
https://github.com/pybind/pybind11/blob/4e3d9fea74ed50a042d98f68fa35a3133482289b/include/pybind11/stl.h#L140).
A user may also opt to write a signature in the docstring that uses generics. Currently
when stubgen parses one of these generics, it attempts to import a part of it. For
example if a docstring had
my_func(str, int) -> List[mypackage.module_being_parsed.MyClass],
the resulting stub file tries to import List[mypackage.module_being_parsed.
This change fixes this behaviour by breaking the found type down into the
multiple types around [], characters, adding any imports from those types
that are needed, and then stripping out the name of the module being parsed.
0 commit comments