From 55bc15fbb3a08c6f0dfffccc228a77f421fb27a1 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 13 Feb 2013 00:50:00 +0100 Subject: [PATCH] Fixed libSystem::Plugin::lookup() --- src/python/libSystem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/python/libSystem.c b/src/python/libSystem.c index 9fbbe62..9cd157a 100644 --- a/src/python/libSystem.c +++ b/src/python/libSystem.c @@ -25,6 +25,7 @@ static char const _libsystem_config_name[] = "libSystem::Config"; static char const _libsystem_event_name[] = "libSystem::Event"; static char const _libsystem_plugin_name[] = "libSystem::Plugin"; +static char const _libsystem_plugin_symbol_name[] = "libSystem::Plugin::symbol"; /* prototypes */ @@ -343,11 +344,13 @@ static PyObject * _libsystem_plugin_lookup(PyObject * self, PyObject * args) char const * symbol; void * ret; + if(!PyArg_ParseTuple(args, "Os", &self, &symbol)) + return NULL; if((plugin = PyCapsule_GetPointer(self, _libsystem_plugin_name)) == NULL) return NULL; - if(!PyArg_ParseTuple(args, "s", &symbol)) + if((ret = plugin_lookup(plugin, symbol)) == NULL) + /* XXX differentiate from a real error */ return NULL; - ret = plugin_lookup(plugin, symbol); - return Py_BuildValue("p", ret); + return PyCapsule_New(ret, _libsystem_plugin_symbol_name, NULL); }