On 2019-10-06 15:48, Ian Pilcher wrote:
On 10/5/19 12:55 PM, Ian Pilcher wrote:
This is straightforward, except that I cannot figure out how to retrieve
the __name__.

Making progress.  I can get a __name__ value with:

    PyDict_GetItemString(PyEval_GetGlobals(), "__name__")

I say "a __name__ value" because the returned value is actually that of
the calling module, not the name of my extension.

Is this normal?

Don't you already have the module's name? You have to specify it in the PyModuleDef struct that you pass to PyModule_Create. Calling PyModule_Create returns a reference to the module, and you can get its namespace dict with PyModule_GetDict(...).
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to