This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brian.curtin
Recipients brian.curtin
Date 2011-08-11.00:40:35
SpamBayes Score 0.0037229066
Marked as misclassified No
Message-id <1313023237.87.0.322234787973.issue12724@psf.upfronthosting.co.za>
In-reply-to
Content
Would anyone be opposed to adding the following simple macro, which would be the same as the one we have for Py_RETURN_NONE. I recently found myself doing the Py_INCREF/return dance several times and ended up leaving an incref out in a few spots, which the macro form nicely handles.

diff --git a/Include/object.h b/Include/object.h
--- a/Include/object.h
+++ b/Include/object.h
@@ -792,6 +792,10 @@
 PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */
 #define Py_NotImplemented (&_Py_NotImplementedStruct)

+/* Macro for returning Py_NotImplemented from a function */
+#define Py_RETURN_NOTIMPLEMENTED \
+    return Py_INCREF(Py_NotImplemented), Py_NotImplemented
+
 /* Rich comparison opcodes */
 #define Py_LT 0
 #define Py_LE 1


If this is fine, I can also take care of making the replacements, of which there are apparently 55.
History
Date User Action Args
2011-08-11 00:40:37brian.curtinsetrecipients: + brian.curtin
2011-08-11 00:40:37brian.curtinsetmessageid: <1313023237.87.0.322234787973.issue12724@psf.upfronthosting.co.za>
2011-08-11 00:40:37brian.curtinlinkissue12724 messages
2011-08-11 00:40:35brian.curtincreate