diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2005-03-03 23:00:26 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2005-03-03 23:00:26 (GMT) |
commit | 96d743ec8bd6e57430116d154db0f1d9d18d2ce0 (patch) | |
tree | 92f1d5a931e85f7fce3ab3c8376f3da0eddfe07f /Python/structmember.c | |
parent | 7e78ade6f9c387aa48b595b43478741299dff3bb (diff) | |
download | cpython-96d743ec8bd6e57430116d154db0f1d9d18d2ce0.zip cpython-96d743ec8bd6e57430116d154db0f1d9d18d2ce0.tar.gz cpython-96d743ec8bd6e57430116d154db0f1d9d18d2ce0.tar.bz2 |
Patch #1115086: support PY_LONGLONG in structmember.
Diffstat (limited to 'Python/structmember.c')
-rw-r--r-- | Python/structmember.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Python/structmember.c b/Python/structmember.c index bbaaca8..1574c95 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -118,6 +118,14 @@ PyMember_GetOne(char *addr, PyMemberDef *l) PyErr_SetString(PyExc_AttributeError, l->name); Py_XINCREF(v); break; +#ifdef HAVE_LONG_LONG + case T_LONGLONG: + v = PyLong_FromLongLong(*(PY_LONG_LONG *)addr); + break; + case T_ULONGLONG: + v = PyLong_FromUnsignedLongLong(*(unsigned PY_LONG_LONG *)addr); + break; +#endif /* HAVE_LONG_LONG */ default: PyErr_SetString(PyExc_SystemError, "bad memberdescr type"); v = NULL; @@ -246,6 +254,30 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) return -1; } break; +#ifdef HAVE_LONG_LONG + case T_LONGLONG: + if (!PyLong_Check(v)) { + PyErr_BadArgument(); + return -1; + } else { + *(PY_LONG_LONG*)addr = PyLong_AsLongLong(v); + if ((*addr == -1) && PyErr_Occurred()) { + return -1; + } + } + break; + case T_ULONGLONG: + if (!PyLong_Check(v)) { + PyErr_BadArgument(); + return -1; + } else { + *(unsigned PY_LONG_LONG*)addr = PyLong_AsUnsignedLongLong(v); + if ((*addr == -1) && PyErr_Occurred()) { + return -1; + } + } + break; +#endif /* HAVE_LONG_LONG */ default: PyErr_Format(PyExc_SystemError, "bad memberdescr type for %s", l->name); |