diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-09-08 16:33:56 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-09-08 16:33:56 (GMT) |
commit | 98ee9d5b738eaf098cfd37c9383f8f2496a964d5 (patch) | |
tree | a8f5041e1ece9795a2b26b61756d5749d3e4834f /Include/pymacro.h | |
parent | 742da040db28e1284615e88874d5c952da80344e (diff) | |
download | cpython-98ee9d5b738eaf098cfd37c9383f8f2496a964d5.zip cpython-98ee9d5b738eaf098cfd37c9383f8f2496a964d5.tar.gz cpython-98ee9d5b738eaf098cfd37c9383f8f2496a964d5.tar.bz2 |
Add Py_MEMBER_SIZE macro
Issue #27350: use Py_MEMBER_SIZE() macro to get the size of
PyDictKeyEntry.dk_indices, rather than hardcoding 8.
Diffstat (limited to 'Include/pymacro.h')
-rw-r--r-- | Include/pymacro.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/pymacro.h b/Include/pymacro.h index d1345c4..2a839ab 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -18,6 +18,9 @@ by "__LINE__". */ #define Py_STRINGIFY(x) _Py_XSTRINGIFY(x) +/* Get the size of a structure member in bytes */ +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) + /* Argument must be a char or an int in [-128, 127] or [0, 255]. */ #define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) |