]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
PyUnicode_KIND() uses _Py_RVALUE() (#100060)
authorVictor Stinner <vstinner@python.org>
Tue, 6 Dec 2022 22:40:05 +0000 (23:40 +0100)
committerGitHub <noreply@github.com>
Tue, 6 Dec 2022 22:40:05 +0000 (23:40 +0100)
The PyUnicode_KIND() macro is modified to use _Py_RVALUE(), so it can
no longer be used as a l-value.

Include/cpython/unicodeobject.h

index a75336f590e81bf2b17ed0ad3ef7d8cca069d771..75a74ffa2f9dff5325b6b4843650a0e09223ed38 100644 (file)
@@ -231,7 +231,7 @@ enum PyUnicode_Kind {
 // new compiler warnings on "kind < PyUnicode_KIND(str)" (compare signed and
 // unsigned numbers) where kind type is an int or on
 // "unsigned int kind = PyUnicode_KIND(str)" (cast signed to unsigned).
-#define PyUnicode_KIND(op) (_PyASCIIObject_CAST(op)->state.kind)
+#define PyUnicode_KIND(op) _Py_RVALUE(_PyASCIIObject_CAST(op)->state.kind)
 
 /* Return a void pointer to the raw unicode buffer. */
 static inline void* _PyUnicode_COMPACT_DATA(PyObject *op) {