On Jul 5, 8:12 pm, a...@pythoncraft.com (Aahz) wrote: > In article > <6f6be2b9-49f4-4db0-9c21-52062d8ea...@l31g2000yqb.googlegroups.com>, > > > > Pedram <pm567...@gmail.com> 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 (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ > > "as long as we like the same operating system, things are cool." --piranha
No, they wrapped the 3rd line! I'll show you the code in picture below: http://lh3.ggpht.com/_35nHfALLgC4/SlDVMEl6oOI/AAAAAAAAAKg/vPWA1gttvHM/s640/Screenshot.png As you can see the PyObject_MALLOC has nothing to do with typeobj and n in line 4. -- http://mail.python.org/mailman/listinfo/python-list