Skip to content

Conversation

@skarndev
Copy link

@skarndev skarndev commented Jan 17, 2026

Added a generalized algorithm to handle builtins exposed via the types module, but reporting builtins at introspection.

Why

Importing types, via pybind11 such as py::module::import("types").attr("MappingProxyType") currently yields an unresolved name "mappingproxy" in the generated .pyi stubs.
The reason for this is that the MappingProxyType.__qualname__ at runtime is "mappingproxy" and __module__ is "builtins". However, the actual builtins module does not expose this as an importable attribute.

There are a number of other "hidden" builtins that follow this pattern. They all seem to come from the types module. I also left room for overriding this behavior, as was done before for "function" and "builtin_function_or_method".

Added a generalized algorithm to handle builtins exposed via the 
`types` module, but reporting `builtins` at introspection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant