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.
--- 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(