diff options
| author | Victor Stinner <vstinner@python.org> | 2021-11-30 12:14:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-30 12:14:45 +0100 |
| commit | c19c3a09618ac400538ee412f84be4c1196c7bab (patch) | |
| tree | 538842c2c053a4f62123ad5244b77aef64ec14c6 /Include/cpython/listobject.h | |
| parent | f97ec09baf8431494fd2ef5133090c7b0afd0551 (diff) | |
| download | cpython-git-c19c3a09618ac400538ee412f84be4c1196c7bab.tar.gz | |
bpo-45476: Add _Py_RVALUE() macro (GH-29860)
Add a new _Py_RVALUE() macro to prevent using an expression as an
l-value.
Replace a "(void)" cast with the _Py_RVALUE() macro in the following
macros:
* PyCell_SET()
* PyList_SET_ITEM()
* PyTuple_SET_ITEM()
* _PyGCHead_SET_FINALIZED()
* _PyGCHead_SET_NEXT()
* asdl_seq_SET()
* asdl_seq_SET_UNTYPED()
Add also parentheses around macro arguments in PyCell_SET() and
PyTuple_SET_ITEM() macros.
Diffstat (limited to 'Include/cpython/listobject.h')
| -rw-r--r-- | Include/cpython/listobject.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Include/cpython/listobject.h b/Include/cpython/listobject.h index e3239152c4..51687d866c 100644 --- a/Include/cpython/listobject.h +++ b/Include/cpython/listobject.h @@ -30,5 +30,5 @@ PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out); #define _PyList_CAST(op) (assert(PyList_Check(op)), (PyListObject *)(op)) #define PyList_GET_ITEM(op, i) (_PyList_CAST(op)->ob_item[i]) -#define PyList_SET_ITEM(op, i, v) ((void)(_PyList_CAST(op)->ob_item[i] = (v))) +#define PyList_SET_ITEM(op, i, v) _Py_RVALUE(_PyList_CAST(op)->ob_item[i] = (v)) #define PyList_GET_SIZE(op) Py_SIZE(_PyList_CAST(op)) |
