This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit d809ff35947de4040ccc85a36d945211cc22f6d3
Author: Amit Bawer <abawer(a)redhat.com>
AuthorDate: Sun Jun 2 17:44:05 2019 +0300
python: Use PyBytes converter for end_event API
Implications:
- Py2 : no difference
- Py3 : if used, only accept bytes for lockspace name.
---
python/sanlock.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/python/sanlock.c b/python/sanlock.c
index 1f2960e..8f99227 100644
--- a/python/sanlock.c
+++ b/python/sanlock.c
@@ -1539,21 +1539,26 @@ static PyObject *
py_end_event(PyObject *self __unused, PyObject *args)
{
int fd = -1;
- const char *lockspace = NULL;
- int rv;
+ PyObject *lockspace = NULL;
+ int rv = -1;
- if (!PyArg_ParseTuple(args, "is", &fd, &lockspace))
- return NULL;
+ if (!PyArg_ParseTuple(args, "iO&", &fd, convert_to_pybytes,
&lockspace)) {
+ goto finally;
+ }
Py_BEGIN_ALLOW_THREADS
- rv = sanlock_end_event(fd, lockspace, 0 /* flags */);
+ rv = sanlock_end_event(fd, PyBytes_AsString(lockspace), 0 /* flags */);
Py_END_ALLOW_THREADS
if (rv < 0) {
__set_exception(rv, "Unable to unregister event fd");
- return NULL;
+ goto finally;
}
+finally:
+ Py_XDECREF(lockspace);
+ if (rv < 0)
+ return NULL;
Py_RETURN_NONE;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
Show replies by date