summaryrefslogtreecommitdiff
path: root/Include/cpython/unicodeobject.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-28 16:40:08 +0100
committerGitHub <noreply@github.com>2022-11-28 16:40:08 +0100
commit02f72b8b938e301bbaaf0142547014e074bd564c (patch)
tree1ffd7f82d70652c6f480a67fe70aa8ae248fae18 /Include/cpython/unicodeobject.h
parent53eef27133c1da395b3b4d7ce0ab1d5b743ffb41 (diff)
downloadcpython-git-02f72b8b938e301bbaaf0142547014e074bd564c.tar.gz
gh-89653: PEP 670: Convert macros to functions (#99843)
Convert macros to static inline functions to avoid macro pitfalls, like duplication of side effects: * DK_ENTRIES() * DK_UNICODE_ENTRIES() * PyCode_GetNumFree() * PyFloat_AS_DOUBLE() * PyInstanceMethod_GET_FUNCTION() * PyMemoryView_GET_BASE() * PyMemoryView_GET_BUFFER() * PyMethod_GET_FUNCTION() * PyMethod_GET_SELF() * PySet_GET_SIZE() * _PyHeapType_GET_MEMBERS() Changes: * PyCode_GetNumFree() casts PyCode_GetNumFree.co_nfreevars from int to Py_ssize_t to be future proof, and because Py_ssize_t is commonly used in the C API. * PyCode_GetNumFree() doesn't cast its argument: the replaced macro already required the exact type PyCodeObject*. * Add assertions in some functions using "CAST" macros to check the arguments type when Python is built with assertions (debug build). * Remove an outdated comment in unicodeobject.h.
Diffstat (limited to 'Include/cpython/unicodeobject.h')
-rw-r--r--Include/cpython/unicodeobject.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/Include/cpython/unicodeobject.h b/Include/cpython/unicodeobject.h
index 86eeab6727..a75336f590 100644
--- a/Include/cpython/unicodeobject.h
+++ b/Include/cpython/unicodeobject.h
@@ -231,8 +231,6 @@ 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).
-// Only declare the function as static inline function in the limited C API
-// version 3.12 which is stricter.
#define PyUnicode_KIND(op) (_PyASCIIObject_CAST(op)->state.kind)
/* Return a void pointer to the raw unicode buffer. */