From: Jack Jansen Date: Thu, 17 Aug 1995 14:29:23 +0000 (+0000) Subject: Added ResObj_OptNew, like ResObj_New but returns None when passed NULL. X-Git-Tag: v1.3b1~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f37c6d91c1134bd44ee74e2ac77d5e1435f4e71;p=thirdparty%2FPython%2Fcpython.git Added ResObj_OptNew, like ResObj_New but returns None when passed NULL. --- diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py index e2bfa796b9f9..fd4f4e631fbc 100644 --- a/Mac/Modules/res/ressupport.py +++ b/Mac/Modules/res/ressupport.py @@ -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 + """