Commit a2ab72aa authored by Martin Pitt's avatar Martin Pitt
Browse files

_pygi_marshal_from_py_uint64: Re-fix check of negative values

Fix regression from commit 1bfcd5d9 (exposed by several test cases) when using
Python 2.x.

https://bugzilla.gnome.org/show_bug.cgi?id=685000
parent 22c22124
......@@ -565,13 +565,13 @@ _pygi_marshal_from_py_uint64 (PyGIInvokeState *state,
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check (py_long)) {
guint64 long_ = (guint64) PyInt_AsLong (py_long);
if (long_ > G_MAXUINT64) {
long long_ = PyInt_AsLong (py_long);
if (long_ < 0 || long_ > G_MAXUINT64) {
PyErr_Format (PyExc_ValueError, "%" G_GUINT64_FORMAT " not in range %d to %" G_GUINT64_FORMAT,
(gint64) long_, 0, G_MAXUINT64);
return FALSE;
}
ulong_ = long_;
ulong_ = (guint64) long_;
} else
#endif
ulong_ = PyLong_AsUnsignedLongLong (py_long);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment