summaryrefslogtreecommitdiff
path: root/python/rpmfi-py.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2011-12-22 18:59:51 -0500
committerAles Kozumplik <akozumpl@redhat.com>2012-01-02 08:39:39 +0100
commit59378e52205728f7a78be1b329aa159f72e5686e (patch)
tree447d05eab84f6b1e1a16069998f7be6098388377 /python/rpmfi-py.c
parentfdba2538855d8ad94bbe5e9c21c8564d01b20f1e (diff)
downloadlibrpm-tizen-59378e52205728f7a78be1b329aa159f72e5686e.tar.gz
librpm-tizen-59378e52205728f7a78be1b329aa159f72e5686e.tar.bz2
librpm-tizen-59378e52205728f7a78be1b329aa159f72e5686e.zip
fix the signatures of the METH_NOARGS callbacks
Various Python method callbacks have signatures of the form: static PyObject * foo(some_object_subclass *obj) and are registered within the PyMethodDef tables with the METH_NOARGS flag [1], with a cast to (PyCFunction) due to the PyObject/subclass mismatch. However, such callbacks do receive two arguments: they are invoked with a signature of this form: static PyObject * foo(some_object_subclass *obj, PyObject *ignored) The CPython interpreter only uses METH_NOARGS to allow it to pass NULL as the second parameter: there are still two parameters. The dispatch code is in Python's Python/ceval.c:call_function: if (flags & METH_NOARGS && na == 0) { C_TRACE(x, (*meth)(self,NULL)); } The fact that this has ever worked may be a coincidence of the platform/compiler's calling conventions, and I don't think it's guaranteed to keep working. [1] http://docs.python.org/c-api/structures.html#METH_NOARGS Signed-off-by: Ales Kozumplik <akozumpl@redhat.com>
Diffstat (limited to 'python/rpmfi-py.c')
-rw-r--r--python/rpmfi-py.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c
index a43fee323..4bfcc81e2 100644
--- a/python/rpmfi-py.c
+++ b/python/rpmfi-py.c
@@ -14,74 +14,74 @@ struct rpmfiObject_s {
};
static PyObject *
-rpmfi_FC(rpmfiObject * s)
+rpmfi_FC(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiFC(s->fi));
}
static PyObject *
-rpmfi_FX(rpmfiObject * s)
+rpmfi_FX(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiFX(s->fi));
}
static PyObject *
-rpmfi_DC(rpmfiObject * s)
+rpmfi_DC(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiDC(s->fi));
}
static PyObject *
-rpmfi_DX(rpmfiObject * s)
+rpmfi_DX(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiDX(s->fi));
}
static PyObject *
-rpmfi_BN(rpmfiObject * s)
+rpmfi_BN(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("s", rpmfiBN(s->fi));
}
static PyObject *
-rpmfi_DN(rpmfiObject * s)
+rpmfi_DN(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("s", rpmfiDN(s->fi));
}
static PyObject *
-rpmfi_FN(rpmfiObject * s)
+rpmfi_FN(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("s", rpmfiFN(s->fi));
}
static PyObject *
-rpmfi_FFlags(rpmfiObject * s)
+rpmfi_FFlags(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiFFlags(s->fi));
}
static PyObject *
-rpmfi_VFlags(rpmfiObject * s)
+rpmfi_VFlags(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiVFlags(s->fi));
}
static PyObject *
-rpmfi_FMode(rpmfiObject * s)
+rpmfi_FMode(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiFMode(s->fi));
}
static PyObject *
-rpmfi_FState(rpmfiObject * s)
+rpmfi_FState(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiFState(s->fi));
}
/* XXX rpmfiFDigest */
static PyObject *
-rpmfi_Digest(rpmfiObject * s)
+rpmfi_Digest(rpmfiObject * s, PyObject * unused)
{
char *digest = rpmfiFDigestHex(s->fi, NULL);
if (digest) {
@@ -94,49 +94,49 @@ rpmfi_Digest(rpmfiObject * s)
}
static PyObject *
-rpmfi_FLink(rpmfiObject * s)
+rpmfi_FLink(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("s", rpmfiFLink(s->fi));
}
static PyObject *
-rpmfi_FSize(rpmfiObject * s)
+rpmfi_FSize(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("L", rpmfiFSize(s->fi));
}
static PyObject *
-rpmfi_FRdev(rpmfiObject * s)
+rpmfi_FRdev(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiFRdev(s->fi));
}
static PyObject *
-rpmfi_FMtime(rpmfiObject * s)
+rpmfi_FMtime(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiFMtime(s->fi));
}
static PyObject *
-rpmfi_FUser(rpmfiObject * s)
+rpmfi_FUser(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("s", rpmfiFUser(s->fi));
}
static PyObject *
-rpmfi_FGroup(rpmfiObject * s)
+rpmfi_FGroup(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("s", rpmfiFGroup(s->fi));
}
static PyObject *
-rpmfi_FColor(rpmfiObject * s)
+rpmfi_FColor(rpmfiObject * s, PyObject * unused)
{
return Py_BuildValue("i", rpmfiFColor(s->fi));
}
static PyObject *
-rpmfi_FClass(rpmfiObject * s)
+rpmfi_FClass(rpmfiObject * s, PyObject * unused)
{
const char * FClass;
@@ -196,7 +196,7 @@ rpmfi_iternext(rpmfiObject * s)
PyTuple_SET_ITEM(result, 11, Py_None);
} else
PyTuple_SET_ITEM(result, 11, Py_BuildValue("s", FGroup));
- PyTuple_SET_ITEM(result, 12, rpmfi_Digest(s));
+ PyTuple_SET_ITEM(result, 12, rpmfi_Digest(s, NULL));
} else
s->active = 0;