# HG changeset patch # User Nicolas Dumazet # Date 1251366921 -7200 # Node ID 5d6659cfaa068661846e10fedef2dd157c47a47e # Parent d37c0f4e8f48f40048d18ae31e1d430c4b143206 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. diff -r d37c0f4e8f48 -r 5d6659cfaa06 hgext/inotify/linux/_inotify.c --- 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(