From 9f37c6d91c1134bd44ee74e2ac77d5e1435f4e71 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Thu, 17 Aug 1995 14:29:23 +0000 Subject: Added ResObj_OptNew, like ResObj_New but returns None when passed NULL. --- Mac/Modules/res/ressupport.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py index e2bfa79..fd4f4e6 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 + """ -- cgit v0.12