[Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.55,2.56
Fred L. Drake
fdrake@users.sourceforge.net
2001年3月22日 09:52:20 -0800
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv22886
Modified Files:
cPickle.c
Log Message:
Make cPickle use the recently-added PyInstance_NewRaw() API to create
instance objects without calling the constructor. This is the same as
the new.instance() function.
Index: cPickle.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v
retrieving revision 2.55
retrieving revision 2.56
diff -C2 -r2.55 -r2.56
*** cPickle.c 2001年03月17日 04:50:51 2.55
--- cPickle.c 2001年03月22日 17:52:17 2.56
***************
*** 2923,2940 ****
/* We have a class with no __getinitargs__, so bypass usual
construction */
! PyInstanceObject *inst;
PyErr_Clear();
! UNLESS (inst=PyObject_New(PyInstanceObject, &PyInstance_Type))
goto err;
! inst->in_class=(PyClassObject*)cls;
! Py_INCREF(cls);
! UNLESS (inst->in_dict=PyDict_New()) {
! inst = (PyInstanceObject *) PyObject_AS_GC(inst);
! PyObject_DEL(inst);
! goto err;
! }
! PyObject_GC_Init(inst);
! return (PyObject *)inst;
}
Py_DECREF(__getinitargs__);
--- 2923,2932 ----
/* We have a class with no __getinitargs__, so bypass usual
construction */
! PyObject *inst;
PyErr_Clear();
! UNLESS (inst=PyInstance_NewRaw(cls, NULL))
goto err;
! return inst;
}
Py_DECREF(__getinitargs__);