How Python Implements "long integer"?

Aahz aahz at
Sun Jul 5 18:12:19 CEST 2009

In article <6f6be2b9-49f4-4db0-9c21-52062d8ea3df at>,
Pedram  <pm567426 at> wrote:
>This time I have a simple C question!
>As you know, _PyLong_New returns the result of PyObject_NEW_VAR. I
>found PyObject_NEW_VAR in objimpl.h header file. But I can't
>understand the last line :( Here's the code:
>#define PyObject_NEW_VAR(type, typeobj, n) \
>( (type *) PyObject_InitVar( \
>      (PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj),
>(n)) ),\
>      (typeobj), (n)) )
>I know this will replace the PyObject_New_VAR(type, typeobj, n)
>everywhere in the code and but I can't understand the last line, which
>is just 'typeobj' and 'n'! What do they do? Are they make any sense in
>allocation process?

Look in the code to find out what PyObject_InitVar() does -- and, more
importantly, what its signature is.  The clue you're missing is the
trailing backslash on the third line, but that should not be required if
you're using an editor that shows you matching parentheses.
Aahz (aahz at           <*>

"as long as we like the same operating system, things are cool." --piranha

More information about the Python-list mailing list