diff options
author | Victor Stinner <vstinner@python.org> | 2021-11-30 14:13:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-30 14:13:55 (GMT) |
commit | 4b97d974ecca9cce532be55410fe851eb9fdcf21 (patch) | |
tree | 210f4aa94de1d93dcc1e7c3dcddeddf2098de7cb | |
parent | c19c3a09618ac400538ee412f84be4c1196c7bab (diff) | |
download | cpython-4b97d974ecca9cce532be55410fe851eb9fdcf21.zip cpython-4b97d974ecca9cce532be55410fe851eb9fdcf21.tar.gz cpython-4b97d974ecca9cce532be55410fe851eb9fdcf21.tar.bz2 |
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.
-rw-r--r-- | Include/internal/pycore_asdl.h | 6 |
1 files 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) \ |