Mercurial > hg-stable
changeset 9428:5d6659cfaa06
inotify: _inotify.c: bugfix: remove_watch has to return PyNone on success
We are not currently using that API function in inotify, hence the reason
for the "silent" bug. But returning NULL here causes the interpreter to crash.
Let's keep code clean for reusers :)
The whole "bail" logic was unneeded here.
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Thu, 27 Aug 2009 11:55:21 +0200 |
parents | d37c0f4e8f48 |
children | d8143769e1d4 |
files | hgext/inotify/linux/_inotify.c |
diffstat | 1 files changed, 3 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/inotify/linux/_inotify.c Thu Aug 27 14:15:04 2009 +0200 +++ b/hgext/inotify/linux/_inotify.c Thu Aug 27 11:55:21 2009 +0200 @@ -106,13 +106,12 @@ static PyObject *remove_watch(PyObject *self, PyObject *args) { - PyObject *ret = NULL; uint32_t wd; int fd; int r; if (!PyArg_ParseTuple(args, "iI:remove_watch", &fd, &wd)) - goto bail; + return NULL; Py_BEGIN_ALLOW_THREADS r = inotify_rm_watch(fd, wd); @@ -120,18 +119,11 @@ if (r == -1) { PyErr_SetFromErrno(PyExc_OSError); - goto bail; + return NULL; } Py_INCREF(Py_None); - - goto done; - -bail: - Py_CLEAR(ret); - -done: - return ret; + return Py_None; } PyDoc_STRVAR(