summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-08-17 14:29:23 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-08-17 14:29:23 (GMT)
commit9f37c6d91c1134bd44ee74e2ac77d5e1435f4e71 (patch)
tree050fb6294cfca6bf128efd5c8d2b0f47f2a16459 /Mac
parentcaf7505edc872e1a6dc25b70176227b1d7754e93 (diff)
downloadcpython-9f37c6d91c1134bd44ee74e2ac77d5e1435f4e71.zip
cpython-9f37c6d91c1134bd44ee74e2ac77d5e1435f4e71.tar.gz
cpython-9f37c6d91c1134bd44ee74e2ac77d5e1435f4e71.tar.bz2
Added ResObj_OptNew, like ResObj_New but returns None when passed NULL.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/res/ressupport.py13
1 files changed, 13 insertions, 0 deletions
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 + """