diff options
Diffstat (limited to 'Python/structmember.c')
-rw-r--r-- | Python/structmember.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Python/structmember.c b/Python/structmember.c index 0a24d9d..54eb055 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -260,8 +260,9 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) PyErr_BadArgument(); return -1; } else { - *(PY_LONG_LONG*)addr = PyLong_AsLongLong(v); - if ((*addr == -1) && PyErr_Occurred()) { + PY_LONG_LONG value; + *(PY_LONG_LONG*)addr = value = PyLong_AsLongLong(v); + if ((value == -1) && PyErr_Occurred()) { return -1; } } @@ -271,8 +272,10 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) PyErr_BadArgument(); return -1; } else { - *(unsigned PY_LONG_LONG*)addr = PyLong_AsUnsignedLongLong(v); - if ((*addr == -1) && PyErr_Occurred()) { + unsigned PY_LONG_LONG value; + *(unsigned PY_LONG_LONG*)addr = value = PyLong_AsUnsignedLongLong(v); + if ((value == (unsigned PY_LONG_LONG)-1) && + PyErr_Occurred()) { return -1; } } |