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.
Created on 2011年08月11日 00:40 by brian.curtin, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg141886 - (view) | Author: Brian Curtin (brian.curtin) * (Python committer) | Date: 2011年08月11日 00:40 | |
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. |
|||
| msg141888 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2011年08月11日 00:58 | |
+1 |
|||
| msg141891 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年08月11日 01:34 | |
New changeset 77a65b078852 by Brian Curtin in branch 'default': Add Py_RETURN_NOTIMPLEMENTED macro. Fixes #12724. http://hg.python.org/cpython/rev/77a65b078852 New changeset d0b0fcbb40db by Brian Curtin in branch 'default': Replace Py_NotImplemented returns with the macro form Py_RETURN_NOTIMPLEMENTED. http://hg.python.org/cpython/rev/d0b0fcbb40db New changeset 3a6782f2a4a8 by Brian Curtin in branch 'default': News item for #12724 http://hg.python.org/cpython/rev/3a6782f2a4a8 |
|||
| msg141907 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年08月11日 14:41 | |
New changeset e88362fb4950 by Brian Curtin in branch 'default': Add doc for Py_RETURN_NOTIMPLEMENTED, added in #12724. http://hg.python.org/cpython/rev/e88362fb4950 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:20 | admin | set | github: 56933 |
| 2011年08月11日 14:41:59 | python-dev | set | messages: + msg141907 |
| 2011年08月11日 01:35:25 | brian.curtin | set | status: open -> closed resolution: fixed |
| 2011年08月11日 01:34:38 | python-dev | set | nosy:
+ python-dev messages: + msg141891 |
| 2011年08月11日 00:58:15 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg141888 |
| 2011年08月11日 00:40:37 | brian.curtin | create | |