[Zope3-checkins] CVS: Zope3/src/zope/proxy/context - wrapper.c:1.2.12.2

Fred L. Drake, Jr. fred@zope.com
Tue, 1 Apr 2003 16:20:02 -0500


Update of /cvs-repository/Zope3/src/zope/proxy/context
In directory cvs.zope.org:/tmp/cvs-serv22237

Modified Files:
      Tag: stevea-contextaware_in_c-branch
	wrapper.c 
Log Message:
- don't set ob_type; PyType_Ready() takes care of that in 2.2.2 and newer
- re-indent a few lines


=== Zope3/src/zope/proxy/context/wrapper.c 1.2.12.1 => 1.2.12.2 ===
--- Zope3/src/zope/proxy/context/wrapper.c:1.2.12.1	Tue Apr  1 14:53:06 2003
+++ Zope3/src/zope/proxy/context/wrapper.c	Tue Apr  1 16:20:01 2003
@@ -184,7 +184,7 @@
     }
     if (gs->prop_get == NULL) {
         PyErr_SetString(PyExc_AttributeError, "unreadable attribute");
-                return NULL;
+        return NULL;
     }
     return PyObject_CallFunction(gs->prop_get, "(O)", obj);
 }
@@ -201,9 +201,9 @@
         func = gs->prop_set;
     if (func == NULL) {
         PyErr_SetString(PyExc_AttributeError,
-                value == NULL ?
-                "can't delete attribute" :
-                "can't set attribute");
+                        value == NULL ?
+                        "can't delete attribute" :
+                        "can't set attribute");
         return -1;
     }
     if (value == NULL)
@@ -224,7 +224,7 @@
     propertyobject *gs = (propertyobject *)self;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOO:property",
-                     kwlist, &get, &set, &del, &doc))
+                                     kwlist, &get, &set, &del, &doc))
         return -1;
 
     if (get == Py_None)
@@ -352,7 +352,7 @@
 
     if (cm->cm_callable == NULL) {
         PyErr_SetString(PyExc_RuntimeError,
-                "uninitialized ContextMethod object");
+                        "uninitialized ContextMethod object");
         return NULL;
     }
     if (obj == NULL || obj == Py_None) {
@@ -1354,7 +1354,6 @@
     if (m == NULL)
         return;
 
-    WrapperType.ob_type = &PyType_Type;
     WrapperType.tp_base = ProxyType;
     WrapperType.tp_alloc = PyType_GenericAlloc;
     WrapperType.tp_free = _PyObject_GC_Del;
@@ -1364,27 +1363,23 @@
     Py_INCREF(&WrapperType);
     PyModule_AddObject(m, "Wrapper", (PyObject *)&WrapperType);
 
-    ContextAwareType.ob_type = &PyType_Type;
     if (PyType_Ready(&ContextAwareType) < 0)
         return;
     Py_INCREF(&ContextAwareType);
     PyModule_AddObject(m, "ContextAware", (PyObject *)&ContextAwareType);
 
-    ContextDescriptorType.ob_type = &PyType_Type;
     if (PyType_Ready(&ContextDescriptorType) < 0)
         return;
     Py_INCREF(&ContextDescriptorType);
     PyModule_AddObject(m, "ContextDescriptor",
                        (PyObject *)&ContextDescriptorType);
 
-    ContextMethod_Type.ob_type = &PyType_Type;
     ContextMethod_Type.tp_base = &ContextDescriptorType;
     if (PyType_Ready(&ContextMethod_Type) < 0)
         return;
     Py_INCREF(&ContextMethod_Type);
     PyModule_AddObject(m, "ContextMethod", (PyObject *)&ContextMethod_Type);
 
-    ContextProperty_Type.ob_type = &PyType_Type;
     ContextProperty_Type.tp_base = &ContextDescriptorType;
     if (PyType_Ready(&ContextProperty_Type) < 0)
         return;