Browse Source

increment Py_None correctly

David Rose 19 years ago
parent
commit
0992109979
2 changed files with 4 additions and 1 deletions
  1. 2 0
      direct/src/dcparser/dcClass.cxx
  2. 2 1
      direct/src/dcparser/dcPacker.cxx

+ 2 - 0
direct/src/dcparser/dcClass.cxx

@@ -426,6 +426,7 @@ set_class_def(PyObject *class_def) {
 PyObject *DCClass::
 PyObject *DCClass::
 get_class_def() const {
 get_class_def() const {
   if (_class_def == NULL) {
   if (_class_def == NULL) {
+    Py_INCREF(Py_None);
     return Py_None;
     return Py_None;
   }
   }
 
 
@@ -474,6 +475,7 @@ set_owner_class_def(PyObject *owner_class_def) {
 PyObject *DCClass::
 PyObject *DCClass::
 get_owner_class_def() const {
 get_owner_class_def() const {
   if (_owner_class_def == NULL) {
   if (_owner_class_def == NULL) {
+    Py_INCREF(Py_None);
     return Py_None;
     return Py_None;
   }
   }
 
 

+ 2 - 1
direct/src/dcparser/dcPacker.cxx

@@ -802,6 +802,7 @@ unpack_object() {
   switch (pack_type) {
   switch (pack_type) {
   case PT_invalid:
   case PT_invalid:
     object = Py_None;
     object = Py_None;
+    Py_INCREF(object);
     unpack_skip();
     unpack_skip();
     break;
     break;
 
 
@@ -900,7 +901,7 @@ unpack_object() {
     break;
     break;
   }
   }
 
 
-  nassertr(object != (PyObject *)NULL, Py_None);
+  nassertr(object != (PyObject *)NULL, NULL);
   return object;
   return object;
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON