Commit 4e3c4025 authored by Jim Fulton's avatar Jim Fulton

Fixed bug in deactivation logic. The stupid thing was calling a

constructor when deactivating.
parent ce218e5c
/*********************************************************************** /***********************************************************************
$Id: cPersistence.c,v 1.22 1997/12/15 15:28:09 jim Exp $ $Id: cPersistence.c,v 1.23 1998/01/09 22:19:28 jim Exp $
C Persistence Module C Persistence Module
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
*****************************************************************************/ *****************************************************************************/
static char *what_string = "$Id: cPersistence.c,v 1.22 1997/12/15 15:28:09 jim Exp $"; static char *what_string = "$Id: cPersistence.c,v 1.23 1998/01/09 22:19:28 jim Exp $";
#include <time.h> #include <time.h>
#include "cPersistence.h" #include "cPersistence.h"
...@@ -351,40 +351,7 @@ Per__p___reinit__(cPersistentObject *self, PyObject *args) ...@@ -351,40 +351,7 @@ Per__p___reinit__(cPersistentObject *self, PyObject *args)
if(PyArg_Parse(args,"")) if(PyArg_Parse(args,""))
{ {
if(self->state==cPersistent_UPTODATE_STATE) if(self->state==cPersistent_UPTODATE_STATE)
if(init=PyObject_GetAttr((PyObject*)self,py___init__))
{ {
if(copy=PyObject_GetAttr((PyObject*)self,py___getinitargs__))
{
ASSIGN(copy,PyObject_CallObject(copy,NULL));
UNLESS(copy) goto err;
UNLESS(PyTuple_Check(copy))
{
ASSIGN(copy,PySequence_Tuple(copy));
UNLESS(copy) goto err;
}
}
else
{
copy=NULL;
PyErr_Clear();
}
if(HasInstDict(self) && (dict=INSTANCE_DICT(self)))
PyDict_Clear(dict);
dict=self->jar;
self->jar=NULL; /* Grasping at straws :-( */
ASSIGN(copy,PyObject_CallObject(init,copy));
self->state=cPersistent_GHOST_STATE;
self->jar=dict;
UNLESS(copy) goto err;
Py_DECREF(copy);
Py_DECREF(init);
}
else
{
PyErr_Clear();
if(HasInstDict(self) && (dict=INSTANCE_DICT(self))) if(HasInstDict(self) && (dict=INSTANCE_DICT(self)))
{ {
PyDict_Clear(dict); PyDict_Clear(dict);
...@@ -891,7 +858,7 @@ void ...@@ -891,7 +858,7 @@ void
initcPersistence() initcPersistence()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.22 $"; char *rev="$Revision: 1.23 $";
PATimeType.ob_type=&PyType_Type; PATimeType.ob_type=&PyType_Type;
...@@ -921,6 +888,10 @@ initcPersistence() ...@@ -921,6 +888,10 @@ initcPersistence()
/**************************************************************************** /****************************************************************************
$Log: cPersistence.c,v $ $Log: cPersistence.c,v $
Revision 1.23 1998/01/09 22:19:28 jim
Fixed bug in deactivation logic. The stupid thing was calling a
constructor when deactivating.
Revision 1.22 1997/12/15 15:28:09 jim Revision 1.22 1997/12/15 15:28:09 jim
Some cleanup. Removed unused old routine. Some cleanup. Removed unused old routine.
Renamed _p___reinit__ to _p_deactivate. Renamed _p___reinit__ to _p_deactivate.
......
/*********************************************************************** /***********************************************************************
$Id: cPersistence.c,v 1.22 1997/12/15 15:28:09 jim Exp $ $Id: cPersistence.c,v 1.23 1998/01/09 22:19:28 jim Exp $
C Persistence Module C Persistence Module
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
*****************************************************************************/ *****************************************************************************/
static char *what_string = "$Id: cPersistence.c,v 1.22 1997/12/15 15:28:09 jim Exp $"; static char *what_string = "$Id: cPersistence.c,v 1.23 1998/01/09 22:19:28 jim Exp $";
#include <time.h> #include <time.h>
#include "cPersistence.h" #include "cPersistence.h"
...@@ -351,40 +351,7 @@ Per__p___reinit__(cPersistentObject *self, PyObject *args) ...@@ -351,40 +351,7 @@ Per__p___reinit__(cPersistentObject *self, PyObject *args)
if(PyArg_Parse(args,"")) if(PyArg_Parse(args,""))
{ {
if(self->state==cPersistent_UPTODATE_STATE) if(self->state==cPersistent_UPTODATE_STATE)
if(init=PyObject_GetAttr((PyObject*)self,py___init__))
{ {
if(copy=PyObject_GetAttr((PyObject*)self,py___getinitargs__))
{
ASSIGN(copy,PyObject_CallObject(copy,NULL));
UNLESS(copy) goto err;
UNLESS(PyTuple_Check(copy))
{
ASSIGN(copy,PySequence_Tuple(copy));
UNLESS(copy) goto err;
}
}
else
{
copy=NULL;
PyErr_Clear();
}
if(HasInstDict(self) && (dict=INSTANCE_DICT(self)))
PyDict_Clear(dict);
dict=self->jar;
self->jar=NULL; /* Grasping at straws :-( */
ASSIGN(copy,PyObject_CallObject(init,copy));
self->state=cPersistent_GHOST_STATE;
self->jar=dict;
UNLESS(copy) goto err;
Py_DECREF(copy);
Py_DECREF(init);
}
else
{
PyErr_Clear();
if(HasInstDict(self) && (dict=INSTANCE_DICT(self))) if(HasInstDict(self) && (dict=INSTANCE_DICT(self)))
{ {
PyDict_Clear(dict); PyDict_Clear(dict);
...@@ -891,7 +858,7 @@ void ...@@ -891,7 +858,7 @@ void
initcPersistence() initcPersistence()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.22 $"; char *rev="$Revision: 1.23 $";
PATimeType.ob_type=&PyType_Type; PATimeType.ob_type=&PyType_Type;
...@@ -921,6 +888,10 @@ initcPersistence() ...@@ -921,6 +888,10 @@ initcPersistence()
/**************************************************************************** /****************************************************************************
$Log: cPersistence.c,v $ $Log: cPersistence.c,v $
Revision 1.23 1998/01/09 22:19:28 jim
Fixed bug in deactivation logic. The stupid thing was calling a
constructor when deactivating.
Revision 1.22 1997/12/15 15:28:09 jim Revision 1.22 1997/12/15 15:28:09 jim
Some cleanup. Removed unused old routine. Some cleanup. Removed unused old routine.
Renamed _p___reinit__ to _p_deactivate. Renamed _p___reinit__ to _p_deactivate.
......
/*********************************************************************** /***********************************************************************
$Id: cPersistence.c,v 1.22 1997/12/15 15:28:09 jim Exp $ $Id: cPersistence.c,v 1.23 1998/01/09 22:19:28 jim Exp $
C Persistence Module C Persistence Module
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
*****************************************************************************/ *****************************************************************************/
static char *what_string = "$Id: cPersistence.c,v 1.22 1997/12/15 15:28:09 jim Exp $"; static char *what_string = "$Id: cPersistence.c,v 1.23 1998/01/09 22:19:28 jim Exp $";
#include <time.h> #include <time.h>
#include "cPersistence.h" #include "cPersistence.h"
...@@ -351,40 +351,7 @@ Per__p___reinit__(cPersistentObject *self, PyObject *args) ...@@ -351,40 +351,7 @@ Per__p___reinit__(cPersistentObject *self, PyObject *args)
if(PyArg_Parse(args,"")) if(PyArg_Parse(args,""))
{ {
if(self->state==cPersistent_UPTODATE_STATE) if(self->state==cPersistent_UPTODATE_STATE)
if(init=PyObject_GetAttr((PyObject*)self,py___init__))
{ {
if(copy=PyObject_GetAttr((PyObject*)self,py___getinitargs__))
{
ASSIGN(copy,PyObject_CallObject(copy,NULL));
UNLESS(copy) goto err;
UNLESS(PyTuple_Check(copy))
{
ASSIGN(copy,PySequence_Tuple(copy));
UNLESS(copy) goto err;
}
}
else
{
copy=NULL;
PyErr_Clear();
}
if(HasInstDict(self) && (dict=INSTANCE_DICT(self)))
PyDict_Clear(dict);
dict=self->jar;
self->jar=NULL; /* Grasping at straws :-( */
ASSIGN(copy,PyObject_CallObject(init,copy));
self->state=cPersistent_GHOST_STATE;
self->jar=dict;
UNLESS(copy) goto err;
Py_DECREF(copy);
Py_DECREF(init);
}
else
{
PyErr_Clear();
if(HasInstDict(self) && (dict=INSTANCE_DICT(self))) if(HasInstDict(self) && (dict=INSTANCE_DICT(self)))
{ {
PyDict_Clear(dict); PyDict_Clear(dict);
...@@ -891,7 +858,7 @@ void ...@@ -891,7 +858,7 @@ void
initcPersistence() initcPersistence()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.22 $"; char *rev="$Revision: 1.23 $";
PATimeType.ob_type=&PyType_Type; PATimeType.ob_type=&PyType_Type;
...@@ -921,6 +888,10 @@ initcPersistence() ...@@ -921,6 +888,10 @@ initcPersistence()
/**************************************************************************** /****************************************************************************
$Log: cPersistence.c,v $ $Log: cPersistence.c,v $
Revision 1.23 1998/01/09 22:19:28 jim
Fixed bug in deactivation logic. The stupid thing was calling a
constructor when deactivating.
Revision 1.22 1997/12/15 15:28:09 jim Revision 1.22 1997/12/15 15:28:09 jim
Some cleanup. Removed unused old routine. Some cleanup. Removed unused old routine.
Renamed _p___reinit__ to _p_deactivate. Renamed _p___reinit__ to _p_deactivate.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment