Re: setup() and C extensions

2007-04-10 Thread Carsten Haese
On Mon, 2007-04-09 at 23:35 -0700, 7stud wrote: > 2) When returning None, why use the idiom: > > Py_INCREF(Py_None); > return Py_None; > > instead of: > > return Py_BuildValue(""); > As Gabriel said, the preferred idiom is faster and clearer. Sufficiently recent Pythons define the macro Py_RET

Re: setup() and C extensions

2007-04-10 Thread Gabriel Genellina
En Tue, 10 Apr 2007 03:35:35 -0300, 7stud <[EMAIL PROTECTED]> escribió: > 1) When you create a C array to map python names to the C functions > that you defined: > > static PyMethodDef MyFunctions[] = > { > {"my_calc", (PyCFunction)my_func, METH_VARARGS, "my very speedy c > function"}, >

Re: setup() and C extensions

2007-04-10 Thread Gabriel Genellina
En Tue, 10 Apr 2007 03:02:22 -0300, 7stud <[EMAIL PROTECTED]> escribió: > I can't find any documentation on the setup() function in the > distutils.core module; specifically I want to know what the 'name' > argument does. In some examples in the python docs, they use the name > argument like th

Re: setup() and C extensions

2007-04-09 Thread 7stud
Also: 1) When you create a C array to map python names to the C functions that you defined: static PyMethodDef MyFunctions[] = { {"my_calc", (PyCFunction)my_func, METH_VARARGS, "my very speedy c function"}, {NULL, NULL, 0, NULL} }; Why do you need to cast my_func to PyCFunction? 2) Whe

setup() and C extensions

2007-04-09 Thread 7stud
Hi, I can't find any documentation on the setup() function in the distutils.core module; specifically I want to know what the 'name' argument does. In some examples in the python docs, they use the name argument like this: from distutils.core import setup, Extension module1 = Extension('dem