[Python-Dev] getter/setter function signatures

Thomas Heller thomas.heller@ion-tof.com
Thu, 18 Apr 2002 14:19:57 +0200


The signature for the getter/setter functions in descrobj.h is
  typedef PyObject *(*getter)(PyObject *, void *);
  typedef int (*setter)(PyObject *, PyObject *, void *);

At least descrobject.c, cPickle.c and funcobject.c defines PyGetSetDef
arrays which use function signatures where the last void* parameter is
missing. While obviously this does no harm (so far), it is surely a bug
(or am I missing something)?

-----

Related: I am always wondering, why the compiler (MSVC 6 in my case)
gives a warning when you use these signatures for getter/setter functions

   PyObject *get(wrapperobject *, void *)
   int set(wrapperobject *, PyObject *, void *)

(warning C4028: formal parameter 1 different from declaration),
while if I use these signatures

   PyObject *get(PyObject *)
   int set(PyObject *, PyObject *)

the compilation gives no warning at all. Another MSVC glitch?

Thomas