Skip to content

Instantly share code, notes, and snippets.

@cocoatomo
Created November 18, 2010 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocoatomo/704587 to your computer and use it in GitHub Desktop.
Save cocoatomo/704587 to your computer and use it in GitHub Desktop.
instanciation in Python
/* Objects/object.c in Python2.7 */
PyObject *
_PyObject_New(PyTypeObject *tp)
{
PyObject *op;
op = (PyObject *) PyObject_MALLOC(_PyObject_SIZE(tp));
if (op == NULL)
return PyErr_NoMemory();
return PyObject_INIT(op, tp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment