C API eqivalent of object.__new__

Jacek Generowicz jacek.generowicz at cern.ch
Fri Oct 1 07:43:15 EDT 2004


Jacek Generowicz <jacek.generowicz at cern.ch> writes:

> How would one write object._new__(SomeType) in the C API ?

PyInstance_NewRaw(PyObject *class, [PyObject* dict])

seems to be the way to do this for classic classes. How would one do
it for new-style classes?

Also, how would one create a new-style class "dynamically" in the C
API? IOW, what's the new-style equivalent of PyClass_New? or, put
another way, how would you write

  type(name, (), dict)

in the C API ?



More information about the Python-list mailing list