]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added ResObj_OptNew, like ResObj_New but returns None when passed NULL.
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 17 Aug 1995 14:29:23 +0000 (14:29 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 17 Aug 1995 14:29:23 +0000 (14:29 +0000)
Mac/Modules/res/ressupport.py

index e2bfa796b9f93031d5433625531d445da01b9ad6..fd4f4e631fbcf57985f1b062175e3786618498dd 100644 (file)
@@ -30,6 +30,19 @@ includestuff = includestuff + """
 """
 
 finalstuff = finalstuff + """
+
+/* Alternative version of ResObj_New, which returns None for null argument */
+PyObject *ResObj_OptNew(itself)
+       Handle itself;
+{
+       ResourceObject *it;
+       if (itself == NULL) {
+               Py_INCREF(Py_None);
+               return Py_None;
+       }
+       return ResObj_New(itself);
+}
+
 """
 
 initstuff = initstuff + """