mirror of https://github.com/python/cpython
Added ResObj_OptNew, like ResObj_New but returns None when passed NULL.
This commit is contained in:
parent
caf7505edc
commit
9f37c6d91c
|
@ -30,6 +30,19 @@ includestuff = includestuff + """
|
||||||
"""
|
"""
|
||||||
|
|
||||||
finalstuff = finalstuff + """
|
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 + """
|
initstuff = initstuff + """
|
||||||
|
|
Loading…
Reference in New Issue