A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-September/049133.html below:

[Python-Dev] Finding the module from PyTypeObject?

[Python-Dev] Finding the module from PyTypeObject?Nick Bastin nbastin at opnet.com
Wed Sep 29 22:29:39 CEST 2004
On Sep 29, 2004, at 4:17 PM, Armin Rigo wrote:

> Hello Nick,
>
> On Wed, Sep 29, 2004 at 01:24:23PM -0400, Nick Bastin wrote:
>> Ok, maybe more appropriately, what do people think of adding a
>> PyType_GetModule (PyTypeObject *) which basically functions like
>> type_module(PyTypeObject *, void *) (in Objects/typeobject.c) to the
>> public C API, rather than having to dig around in the object
>> themselves?
>
> It looks overkill, when you can do instead:
>
>   PyObject* module_name = PyObject_GetAttrString(type, "__module__");

That only works most of the time, I think.  To be honest, I didn't try 
that, but it doesn't seem that type_module would jump through the hoops 
it does if that worked all of the time, unless parsing tp_name is 
legacy code.

--
Nick

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4