[Zope-dev] ExtensionClass: calling basicnew from C code

Andrew M. Kuchling akuchlin@mems-exchange.org
Mon, 24 Apr 2000 14:33:54 -0400 (EDT)


I'm still working with ExtensionClass to build a Versant module that
supports persistence nicely, and just discovered the __basicnew__
method that returns an uninitialized instance of a class.  Is there a
good way to get the same effect as this method from the C level?  
Other than the following code:

	basicnew = PyObject_GetAttrString( classObj, "__basicnew__" );
	if (basicnew == NULL) { 
		Py_DECREF( classObj );
		return NULL;
	}

	Erg = (VLinkObject*)PyEval_CallObjectWithKeywords(basicnew,NULL,NULL); 

This code seems to work fine; having to do a getattr seems inelegant,
that's all.
      
-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
I was never so amazed in my life as when the Sniffer drew his concealed weapon
from its case and struck me to the ground, stone dead.
  -- Robertson Davies, first line of _Murther and Walking Spirits_