[Zodb-checkins] CVS: Zope3/src/persistence - persistence.c:1.4
Jeremy Hylton
jeremy@zope.com
Mon, 24 Feb 2003 17:03:53 -0500
Update of /cvs-repository/Zope3/src/persistence
In directory cvs.zope.org:/tmp/cvs-serv11352
Modified Files:
persistence.c
Log Message:
Make sure _p_deactivate() does nothing unless object has oid and dm.
Add test that object states in UPTODATE state when deactivate is
called without an oid.
=== Zope3/src/persistence/persistence.c 1.3 => 1.4 ===
--- Zope3/src/persistence/persistence.c:1.3 Tue Dec 31 16:12:34 2002
+++ Zope3/src/persistence/persistence.c Mon Feb 24 17:03:52 2003
@@ -41,15 +41,15 @@
{
PyObject *meth, *arg, *result;
- if (self->po_dm == NULL)
+ if (!self->po_dm)
return 0;
- if (s_register == NULL)
+ if (!s_register)
s_register = PyString_InternFromString("register");
meth = PyObject_GetAttr((PyObject *)self->po_dm, s_register);
if (meth == NULL)
return 0;
arg = PyTuple_New(1);
- if (arg == NULL) {
+ if (!arg) {
Py_DECREF(meth);
return 0;
}
@@ -218,7 +218,7 @@
static PyObject *
persist_deactivate(PyPersistObject *self)
{
- if (self->po_state == UPTODATE && self->po_dm) {
+ if (self->po_state == UPTODATE && self->po_dm && self->po_oid) {
PyObject **pdict = _PyObject_GetDictPtr((PyObject *)self);
if (pdict && *pdict) {
Py_DECREF(*pdict);
@@ -280,7 +280,7 @@
/* If the object isn't registered with a data manager, setting its
state is meaningless.
*/
- if (self->po_dm == NULL || self->po_oid == NULL)
+ if (!self->po_dm || !self->po_oid)
return 0;
if (v == Py_None)