[Xcb] [PATCH 2/7] Ensure that there's still a valid connection to the X server before attempting to send a request.
Alex Plotnick
shrike at netaxs.com
Thu Mar 8 09:32:04 PST 2012
At or around Thu, 08 Mar 2012 16:19:20 +0100, Julien Danjou said:
> > + /* Check the connection */
> > + if (xpybConn_invalid(self->conn))
> > + return NULL;
> > +
> Hm, "return NULL" seems horrible. Why about raising an exception?
An exception is raised in that case. If xpybConn_invalid detects
an invalid connection, it sets an appropriate exception and returns
a non-zero value as an error indicator. The NULL we return in that
case is also an error indicator (because we return a PyObject*); the
exception is already set. This is a standard Python/C API idiom: see
<http://docs.python.org/c-api/intro.html#exceptions>.
-- Alex
More information about the Xcb
mailing list