Message141886
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. |
|
Date |
User |
Action |
Args |
2011-08-11 00:40:37 | brian.curtin | set | recipients:
+ brian.curtin |
2011-08-11 00:40:37 | brian.curtin | set | messageid: <1313023237.87.0.322234787973.issue12724@psf.upfronthosting.co.za> |
2011-08-11 00:40:37 | brian.curtin | link | issue12724 messages |
2011-08-11 00:40:35 | brian.curtin | create | |
|