This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit 6640e5a8a91b41aa98d9532f86c5dc0e75fa4cdc
Author: Amit Bawer <abawer(a)redhat.com>
AuthorDate: Fri May 17 13:55:52 2019 +0300
python: Provide helper for Py{Int,Long}_AsUnsignedLongLongMask
This is part of patches for making numerical API compatible
with Py3 and Py2.
All use-cases of this function assigns value to uint64_t vars
so we switch to respective AsUnsignedLongLongMask APIs.
Current status:
- Py2: build and testing should be Okay.
- Py3: build will fail for missing numerical APIs.
Signed-off-by: Amit Bawer <abawer(a)redhat.com>
---
python/sanlock.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/python/sanlock.c b/python/sanlock.c
index 108a7b8..9109032 100644
--- a/python/sanlock.c
+++ b/python/sanlock.c
@@ -71,6 +71,16 @@ __set_exception(int en, char *msg)
}
}
+static uint64_t
+pyinteger_as_unsigned_long_long_mask(PyObject *obj)
+{
+#if PY_MAJOR_VERSION == 2
+ return PyInt_AsUnsignedLongLongMask(obj);
+#else
+ return PyLong_AsUnsignedLongLongMask(obj);
+#endif
+}
+
/*
* Returns NULL-terminated representation of the contents of obj.
*
@@ -1092,7 +1102,7 @@ py_acquire(PyObject *self __unused, PyObject *args, PyObject
*keywds)
/* prepare the resource version */
if (version != Py_None) {
res->flags |= SANLK_RES_LVER;
- res->lver = PyInt_AsUnsignedLongMask(version);
+ res->lver = pyinteger_as_unsigned_long_long_mask(version);
if (res->lver == -1) {
__set_exception(EINVAL, "Unable to convert the version value");
goto exit_fail;
@@ -1208,7 +1218,7 @@ py_request(PyObject *self __unused, PyObject *args, PyObject
*keywds)
flags = SANLK_REQUEST_NEXT_LVER;
} else {
res->flags |= SANLK_RES_LVER;
- res->lver = PyInt_AsUnsignedLongMask(version);
+ res->lver = pyinteger_as_unsigned_long_long_mask(version);
if (res->lver == -1) {
__set_exception(EINVAL, "Unable to convert the version value");
goto exit_fail;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
Show replies by date