David Zeuthen 50afc3e
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
David Zeuthen 50afc3e
Date: Wed, 21 Feb 2007 12:31:15 +0000 (+0000)
David Zeuthen 50afc3e
Subject: Don't examine args for functions declared METH_NOARGS.
David Zeuthen 50afc3e
X-Git-Url: http://gitweb.freedesktop.org/?p=dbus/dbus-python.git;a=commitdiff;h=8dce2df1ceacffb2aa6e2cc8b1d4b58ee95ac5b1
David Zeuthen 50afc3e
David Zeuthen 50afc3e
Don't examine args for functions declared METH_NOARGS.
David Zeuthen 50afc3e
It's not guaranteed to be non-NULL, and Python checks there are no arguments
David Zeuthen 50afc3e
so we don't have to.
David Zeuthen 50afc3e
---
David Zeuthen 50afc3e
David Zeuthen 50afc3e
--- a/_dbus_bindings/conn-methods.c
David Zeuthen 50afc3e
+++ b/_dbus_bindings/conn-methods.c
David Zeuthen 50afc3e
@@ -226,10 +226,9 @@ PyDoc_STRVAR(Connection_close__doc__,
David Zeuthen 50afc3e
 "close()\n\n"
David Zeuthen 50afc3e
 "Close the connection.");
David Zeuthen 50afc3e
 static PyObject *
David Zeuthen 50afc3e
-Connection_close (Connection *self, PyObject *args)
David Zeuthen 50afc3e
+Connection_close (Connection *self, PyObject *args UNUSED)
David Zeuthen 50afc3e
 {
David Zeuthen 50afc3e
     TRACE(self);
David Zeuthen 50afc3e
-    if (!PyArg_ParseTuple(args, ":close")) return NULL;
David Zeuthen 50afc3e
     /* Because the user explicitly asked to close the connection, we'll even
David Zeuthen 50afc3e
     let them close shared connections. */
David Zeuthen 50afc3e
     if (self->conn) {
David Zeuthen 50afc3e
@@ -244,13 +243,12 @@ PyDoc_STRVAR(Connection_get_is_connected
David Zeuthen 50afc3e
 "get_is_connected() -> bool\n\n"
David Zeuthen 50afc3e
 "Return true if this Connection is connected.\n");
David Zeuthen 50afc3e
 static PyObject *
David Zeuthen 50afc3e
-Connection_get_is_connected (Connection *self, PyObject *args)
David Zeuthen 50afc3e
+Connection_get_is_connected (Connection *self, PyObject *args UNUSED)
David Zeuthen 50afc3e
 {
David Zeuthen 50afc3e
     dbus_bool_t ret;
David Zeuthen 50afc3e
 
David Zeuthen 50afc3e
     TRACE(self);
David Zeuthen 50afc3e
     DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn);
David Zeuthen 50afc3e
-    if (!PyArg_ParseTuple(args, ":get_is_connected")) return NULL;
David Zeuthen 50afc3e
     Py_BEGIN_ALLOW_THREADS
David Zeuthen 50afc3e
     ret = dbus_connection_get_is_connected(self->conn);
David Zeuthen 50afc3e
     Py_END_ALLOW_THREADS
David Zeuthen 50afc3e
@@ -261,13 +259,12 @@ PyDoc_STRVAR(Connection_get_is_authentic
David Zeuthen 50afc3e
 "get_is_authenticated() -> bool\n\n"
David Zeuthen 50afc3e
 "Return true if this Connection was ever authenticated.\n");
David Zeuthen 50afc3e
 static PyObject *
David Zeuthen 50afc3e
-Connection_get_is_authenticated (Connection *self, PyObject *args)
David Zeuthen 50afc3e
+Connection_get_is_authenticated (Connection *self, PyObject *args UNUSED)
David Zeuthen 50afc3e
 {
David Zeuthen 50afc3e
     dbus_bool_t ret;
David Zeuthen 50afc3e
 
David Zeuthen 50afc3e
     TRACE(self);
David Zeuthen 50afc3e
     DBUS_PY_RAISE_VIA_NULL_IF_FAIL(self->conn);
David Zeuthen 50afc3e
-    if (!PyArg_ParseTuple(args, ":get_is_authenticated")) return NULL;
David Zeuthen 50afc3e
     Py_BEGIN_ALLOW_THREADS
David Zeuthen 50afc3e
     ret = dbus_connection_get_is_authenticated(self->conn);
David Zeuthen 50afc3e
     Py_END_ALLOW_THREADS