[Zodb-checkins] CVS: ZODB3/Persistence - cPersistence.c:1.72.8.27
Tim Peters
tim.one at comcast.net
Mon Jul 14 18:52:14 EDT 2003
Update of /cvs-repository/ZODB3/Persistence
In directory cvs.zope.org:/tmp/cvs-serv22493/Persistence
Modified Files:
Tag: zodb33-devel-branch
cPersistence.c
Log Message:
Trimmed trailing whitespace.
=== ZODB3/Persistence/cPersistence.c 1.72.8.26 => 1.72.8.27 ===
--- ZODB3/Persistence/cPersistence.c:1.72.8.26 Mon Jul 14 17:41:32 2003
+++ ZODB3/Persistence/cPersistence.c Mon Jul 14 17:52:08 2003
@@ -2,16 +2,16 @@
Copyright (c) 2001, 2002 Zope Corporation and Contributors.
All Rights Reserved.
-
+
This software is subject to the provisions of the Zope Public License,
Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
FOR A PARTICULAR PURPOSE
-
+
****************************************************************************/
-static char cPersistence_doc_string[] =
+static char cPersistence_doc_string[] =
"Defines Persistent mixin class for persistent objects.\n"
"\n"
"$Id$\n";
@@ -174,7 +174,7 @@
PyObject *meth, *arg, *result;
static PyObject *s_register;
- if (s_register == NULL)
+ if (s_register == NULL)
s_register = PyString_InternFromString("register");
meth = PyObject_GetAttr((PyObject *)self->jar, s_register);
if (meth == NULL)
@@ -208,7 +208,7 @@
Py_DECREF(*dictptr);
*dictptr = NULL;
}
- /* Note that we need to set to ghost state unless we are
+ /* Note that we need to set to ghost state unless we are
called directly. Methods that override this need to
do the same! */
ghostify(self);
@@ -222,7 +222,7 @@
If the object has no dict, it's state is None.
Otherwise, return a dict containing all the attributes that
- don't start with "_v_".
+ don't start with "_v_".
The caller should not modify this dict, as it may be a reference to
the object's __dict__.
@@ -249,7 +249,7 @@
while (PyDict_Next(__dict__, &pos, &k, &v)) {
if (!PyString_Check(k)) {
- PyErr_Format(PyExc_TypeError,
+ PyErr_Format(PyExc_TypeError,
"expected string for attribute name, found %s",
k->ob_type->tp_name);
return NULL;
@@ -259,7 +259,7 @@
break;
}
}
-
+
if (copy) {
d = PyDict_New();
if (!d)
@@ -279,7 +279,7 @@
Py_INCREF(__dict__);
return __dict__;
-}
+}
static PyObject *
Per__setstate__(cPersistentObject *self, PyObject *v)
@@ -297,7 +297,7 @@
return NULL;
}
__dict__ = *dictptr;
-
+
if (PyDict_Check(v)) {
i = 0;
while (PyDict_Next(v, &i, &key, &e)) {
@@ -308,13 +308,13 @@
else {
UNLESS(keys=callmethod(v,py_keys)) goto err;
UNLESS(-1 != (l=PyObject_Length(keys))) goto err;
-
+
for(i=0; i < l; i++) {
UNLESS_ASSIGN(key,PySequence_GetItem(keys,i)) goto err;
UNLESS_ASSIGN(e,PyObject_GetItem(v,key)) goto err;
UNLESS(-1 != PyDict_SetItem(__dict__,key,e)) goto err;
}
-
+
Py_XDECREF(key);
Py_XDECREF(e);
Py_DECREF(keys);
@@ -334,7 +334,7 @@
Per__reduce__(cPersistentObject *self)
{
PyObject *state, *args=NULL, *result, *__getstate__;
-
+
__getstate__ = PyObject_GetAttr((PyObject*)self, py___getstate__);
if (!__getstate__)
return NULL;
@@ -343,25 +343,25 @@
Py_DECREF(__getstate__);
if (!state)
return NULL;
-
+
args = PyTuple_New(1);
if (!args)
goto err;
-
+
Py_INCREF(self->ob_type);
PyTuple_SET_ITEM(args, 0, (PyObject *)self->ob_type);
-
+
result = PyTuple_New(3);
if (!result)
goto err;
-
+
Py_INCREF(py_simple_new);
PyTuple_SET_ITEM(result, 0, py_simple_new);
PyTuple_SET_ITEM(result, 1, args);
PyTuple_SET_ITEM(result, 2, state);
-
- return result;
-
+
+ return result;
+
err:
Py_DECREF(state);
Py_XDECREF(args);
@@ -378,16 +378,16 @@
"__getstate__() -- Return the state of the object" },
{"__setstate__", (PyCFunction)Per__setstate__, METH_O,
"__setstate__(v) -- Restore the saved state of the object from v" },
-
+
{NULL, NULL} /* sentinel */
};
-/* The Persistent base type provides a traverse function, but not a
+/* The Persistent base type provides a traverse function, but not a
clear function. An instance of a Persistent subclass will have
its dict cleared through subtype_clear().
There is always a cycle between a persistent object and its cache.
- When the cycle becomes unreachable, the clear function for the
+ When the cycle becomes unreachable, the clear function for the
cache will break the cycle. Thus, the persistent object need not
have a clear function. It would be complex to write a clear function
for the objects, if we needed one, because of the reference count
@@ -397,7 +397,7 @@
static void
Per_dealloc(cPersistentObject *self)
{
- if (self->state >= 0)
+ if (self->state >= 0)
unlink_from_ring(self);
if (self->cache)
cPersistenceCAPI->percachedel(self->cache, self->oid);
@@ -469,10 +469,10 @@
return 1;
if (*s == 'p') {
s++;
- if (*s == '_')
+ if (*s == '_')
return 0; /* _p_ */
else
- return 1;
+ return 1;
}
else if (*s == '_') {
s++;
@@ -521,7 +521,7 @@
}
/* We need to decide on a reasonable way for a programmer to write
- an __setattr__() or __delattr__() hook.
+ an __setattr__() or __delattr__() hook.
The ZODB3 has been that if you write a hook, it will be called if
the attribute is not an _p_ attribute and after doing any necessary
@@ -554,7 +554,7 @@
if (!unghostify(self))
goto Done;
accessed(self);
- if (strncmp(s, "_v_", 3) != 0
+ if (strncmp(s, "_v_", 3) != 0
&& self->state != cPersistent_CHANGED_STATE) {
if (changed(self) < 0)
goto Done;
@@ -599,14 +599,14 @@
if (res)
Py_DECREF(res);
else {
- /* an error occured in _p_deactivate().
-
+ /* an error occured in _p_deactivate().
+
It's not clear what we should do here. The code is
obviously ignoring the exception, but it shouldn't return
0 for a getattr and set an exception. The simplest change
is to clear the exception, but that simply masks the
error.
-
+
XXX We'll print an error to stderr just like exceptions in
__del__(). It would probably be better to log it but that
would be painful from C.
@@ -622,7 +622,7 @@
else if (true)
return changed(self);
- if (self->state >= 0)
+ if (self->state >= 0)
self->state = cPersistent_UPTODATE_STATE;
return 0;
}
@@ -710,7 +710,7 @@
"_p_serial must be an 8-character string");
return -1;
}
- } else
+ } else
memset(self->serial, 0, 8);
return 0;
}
@@ -729,7 +729,7 @@
Py_INCREF(Py_None);
return Py_None;
}
-
+
t = PyObject_CallFunction(TimeStamp, "s#", self->serial, 8);
if (!t)
return NULL;
@@ -822,7 +822,7 @@
static cPersistenceCAPIstruct
truecPersistenceCAPI = {
- &Pertype,
+ &Pertype,
(getattrofunc)Per_getattro, /*tp_getattr with object key*/
(setattrofunc)Per_setattro, /*tp_setattr with object key*/
changed,
@@ -839,10 +839,10 @@
{
PyObject *m, *s;
- if (init_strings() < 0)
+ if (init_strings() < 0)
return;
-
- m = Py_InitModule3("cPersistence", cPersistence_methods,
+
+ m = Py_InitModule3("cPersistence", cPersistence_methods,
cPersistence_doc_string);
Pertype.ob_type = &PyType_Type;
More information about the Zodb-checkins
mailing list