Get __name__ in C extension module

Ian Pilcher arequipeno at gmail.com
Sun Oct 6 10:48:23 EDT 2019


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?

Thanks!

-- 
========================================================================
Ian Pilcher                                         arequipeno at gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================




More information about the Python-list mailing list