[Python-Dev] New type objects and PyObject_New (original) (raw)

David Abrahams David Abrahams" <david.abrahams@rcn.com
Tue, 9 Apr 2002 18:33:14 -0500


Uh, never mind, I'm actually doing this:

    // Don't call the type directly to do the construction, since
    // that would require the registration of an appropriate
    // __init__ function.
    PyObject* raw_result = m_class_object->tp_alloc(m_class_object,

0);

----- Original Message ----- From: "Guido van Rossum" <guido@python.org> To: "David Abrahams" <david.abrahams@rcn.com> Cc: "Thomas Heller" <thomas.heller@ion-tof.com>; <python-dev@python.org> Sent: Tuesday, April 09, 2002 5:54 PM Subject: Re: [Python-Dev] New type objects and PyObject_New

[Thomas Heller] > > It seems possible to create new type objects still with > > PyObjectNew() instead of calling the type object. > > Is this a bug?

[David Abrahams] > I sure hope not! I need that functionality! Um, PyObjectNew() is the low-level allocation function that you should be calling from the type's tpnew, not something you should be calling elsewhere to create an instance of a type. --Guido van Rossum (home page: http://www.python.org/~guido/)