c extension finding the module in object initialization

Robin Becker robin at reportlab.com
Mon Sep 27 05:16:08 EDT 2021


Hi Marc,

Thanks for the suggestion,


On 27/09/2021 09:38, Marc-Andre Lemburg wrote:
> Hi Robin,
>
> seeing that no one replied to your question, I'd suggest to ask this
> on the Python C-API ML:
>
> https://mail.python.org/mailman3/lists/capi-sig.python.org/
>
> That's where the experts are, including the ones who implemented
> the mutli-phase logic.
>
> Cheers,
>

I think I have this working using ob=PyImport_GetModuleDict() followed by PyDict_GetItemString(ob,"modulename"), but I 
will ask there to see if there's a more direct route.

In Python >=3.7 there's PyImport_GetModule, but that seems more complex than is actually required for this simple case 
and has to wait until 3.6 dies for me :(
--
Robin Becker





More information about the Python-list mailing list