git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Get __name__ in C extension module


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" --------
========================================================================