This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master in repository sanlock.
commit 50cabdcb8f52b84948263c62e06a4d6f19287444 Author: Amit Bawer abawer@redhat.com AuthorDate: Sun Jun 2 17:39:26 2019 +0300
python: Use PyBytes converter for reg_event API
Implications:
- Py2 : no difference - Py3 : if used, only accept bytes for lockspace name. --- python/sanlock.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/python/sanlock.c b/python/sanlock.c index ed9b4f0..1f2960e 100644 --- a/python/sanlock.c +++ b/python/sanlock.c @@ -1396,21 +1396,26 @@ unregister the event listener using end_event."); static PyObject * py_reg_event(PyObject *self __unused, PyObject *args) { - const char *lockspace = NULL; + PyObject *lockspace = NULL; int fd = -1;
- if (!PyArg_ParseTuple(args, "s", &lockspace)) - return NULL; + if (!PyArg_ParseTuple(args, "O&", convert_to_pybytes, &lockspace)) { + goto finally; + }
Py_BEGIN_ALLOW_THREADS - fd = sanlock_reg_event(lockspace, NULL /* event */, 0 /* flags */); + fd = sanlock_reg_event(PyBytes_AsString(lockspace), NULL /* event */, 0 /* flags */); Py_END_ALLOW_THREADS
if (fd < 0) { __set_exception(fd, "Unable to register event fd"); - return NULL; + goto finally; }
+finally: + Py_XDECREF(lockspace); + if (fd < 0) + return NULL; return Py_BuildValue("i", fd); }
sanlock-devel@lists.fedorahosted.org