[enet-cvs]CVS: enet/pyenet pyenet.c,1.2,1.3

Lee Salzman enet at sferik.cubik.org
Sun Jul 20 22:31:24 PDT 2003


Update of /home/enet/cvsroot/enet/pyenet
In directory sferik:/tmp/cvs-serv9411

Modified Files:
	pyenet.c 
Log Message:
Committed Ling's fixes


Index: pyenet.c
===================================================================
RCS file: /home/enet/cvsroot/enet/pyenet/pyenet.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pyenet.c	2003/06/23 03:15:28	1.2
+++ pyenet.c	2003/07/21 03:31:21	1.3
@@ -1,4 +1,10 @@
+#ifdef _DEBUG
+#undef _DEBUG
 #include <Python.h>
+#define _DEBUG
+#else
+#include <Python.h>
+#endif
 #include "enet.h"
 
 // #define DO_LOG
@@ -68,7 +74,8 @@
 
     attr = PyObject_GenericGetAttr(self, attr_name);
     // :TODO: Should this be DECREF?
-    Py_INCREF(Py_None);
+    if (NULL != attr)
+        Py_INCREF(Py_None);
     return attr;
 }
 
@@ -104,7 +111,7 @@
     0, // (ternaryfunc)enet_HostType_Call,  /*tp_call*/  // **** FUNCTIONCALL CATCHER
     0,                      /*tp_str*/
     enet_EventObject_GetAttr, /*tp_getattro*/
-    0,                      /*tp_setattro*/
+    PyObject_GenericSetAttr,  /*tp_setattro*/
     0,                      /*tp_as_buffer*/
     Py_TPFLAGS_DEFAULT,     /*tp_flags*/
     0,                      /*tp_doc*/
@@ -419,8 +426,8 @@
     0,       /*tp_hash*/
     0, // (ternaryfunc)enet_HostType_Call,  /*tp_call*/  // **** FUNCTIONCALL CATCHER
     0,                      /*tp_str*/
-    0, //(getattrofunc)enet_HostType_GetAttrO,  /*tp_getattro*/
-    0,                      /*tp_setattro*/
+    PyObject_GenericGetAttr, /*tp_getattro*/
+    PyObject_GenericSetAttr, /*tp_setattro*/
     0,                      /*tp_as_buffer*/
     Py_TPFLAGS_DEFAULT,     /*tp_flags*/
     0,                      /*tp_doc*/
@@ -614,7 +621,8 @@
 
     attr = PyObject_GenericGetAttr((PyObject*)self, attr_name);
     // :TODO: Should below be Py_DECREF???
-    Py_INCREF(attr);
+    if (NULL != attr)
+        Py_INCREF(attr);
     return attr ;
 }
 



More information about the enet-cvs mailing list