From 4b97d974ecca9cce532be55410fe851eb9fdcf21 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 30 Nov 2021 15:13:55 +0100 Subject: bpo-45476: Disallow using asdl_seq_GET() as l-value (GH-29866) The following internal macros can not longer be used as l-value: * asdl_seq_GET() * asdl_seq_GET_UNTYPED() * asdl_seq_LEN() They are modified to use the _Py_RVALUE() macro. --- Include/internal/pycore_asdl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Include/internal/pycore_asdl.h b/Include/internal/pycore_asdl.h index d00a7f0..5b01c7a 100644 --- a/Include/internal/pycore_asdl.h +++ b/Include/internal/pycore_asdl.h @@ -78,9 +78,9 @@ asdl_ ## NAME ## _seq *_Py_asdl_ ## NAME ## _seq_new(Py_ssize_t size, PyArena *a return seq; \ } -#define asdl_seq_GET_UNTYPED(S, I) (S)->elements[(I)] -#define asdl_seq_GET(S, I) (S)->typed_elements[(I)] -#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size) +#define asdl_seq_GET_UNTYPED(S, I) _Py_RVALUE((S)->elements[(I)]) +#define asdl_seq_GET(S, I) _Py_RVALUE((S)->typed_elements[(I)]) +#define asdl_seq_LEN(S) _Py_RVALUE(((S) == NULL ? 0 : (S)->size)) #ifdef Py_DEBUG # define asdl_seq_SET(S, I, V) \ -- cgit v0.12