Conversation
The module template emitted PyType_Ready and a raw conv_table insertion for c2py::py_range in every module. Each module has its own wrap_pytype<py_range> (internal linkage, and CPython dlopens extension modules RTLD_LOCAL, so the copies are never merged), so every import overwrote the entry of the previous one and modules disagreed on the c2py_range type. Delegate both to c2py::register_internal_types, which keeps the first registration. py_range is a c2py implementation detail and the template no longer needs to know about it. Requires c2py with register_internal_types.
The module init fetched the c2py table and threaded it through register_internal_types and add_type_object_to_main, which now reach it themselves. add_type_object_to_main also reports a failure now, so the init returns NULL and the import fails with its exception, instead of returning the module with an exception set and relying on CPython to notice. Requires the matching c2py.
std::regex was only really used to strip the libc++/libstdc++ inline namespaces from type names, where plain string search is enough. The four other includes were unused.
str_t is not a c2py name. The generated code compiled only because c2py declared that alias at global scope in serialization/as_tuple.hpp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a check for a registration failure if a type is loaded twice