[Python-Dev] Re: [Python-checkins] python/dist/src/Modules _randommodule.c,1.1,1.2

Neal Norwitz neal@metaslash.com
Tue, 31 Dec 2002 17:28:23 -0500


On Tue, Dec 31, 2002 at 05:14:17PM -0500, Tim Peters wrote:
> 
> And then, for example, before:
> 
> > ! 	PyObject_GenericGetAttr,	/*tp_getattro*/
> 
> and after:
> 
> > ! 	0,				/*tp_getattro*/
> 
> followed by:
> 
> > + 	Random_Type.tp_getattro = PyObject_GenericGetAttr;
> > + 	Random_Type.tp_alloc = PyType_GenericAlloc;
> > + 	Random_Type.tp_free = _PyObject_Del;
> 
> in the module init function.
> 
> Please don't make this kind of change -- it makes the code so much harder to
> follow.  If this is needed for Cygwin, then, e.g., do
> 
> #define DEFERRED(x) 0 /* some boxes can't resolve addresses at compile-time
> */
> 
> and make the "after" line
> 
>      DEFERRED(PyObject_GenericGetAttr), /*tp_getattro*/
> 
> IOW, the type slots should be readable on their own, as a static unit.

I agree, this makes sense.  The only problem is that the
functions/methods will have to be specified twice.  It would be nice
if we only had to specify each once.  Any ideas?

There are several places this has already been done (and at least one
more coming).  Do you want a global Py_DEFERRED() or some other name?

Neal