/*
* Python call with multiple args is like Array
*/
- Target_Type argv = Target_SizedArray(argc);
- while(argc-- > 0) {
- Target_Append(argv, va_arg(ap, Target_Type));
+ Target_Type argv = PyTuple_New(argc);
+ int i;
+ for (i = 0; i < argc; ++i)
+ {
+ PyObject* arg = va_arg(ap, PyObject*);
+ if (arg == NULL)
+ {
+ arg = Py_None;
+ Py_IncRef(arg);
+ }
+ PyTuple_SET_ITEM(argv, i, arg);
}
PyObject *pyfunc = PyObject_GetAttrString(instance, name);
if (pyfunc == NULL)
{
+ printf("%s not defined\n", name);
PyErr_Print();
PyErr_Clear();
goto cleanup;
}
if (! PyCallable_Check(pyfunc))
{
+ printf("%s not callable\n", name);
goto cleanup;
}
result = PyObject_CallObject(pyfunc, argv);
if (PyErr_Occurred())
{
+ printf("%s returned error\n", name);
+ PyErr_Print();
PyErr_Clear();
goto cleanup;
}
cleanup:
if (pyfunc) Py_DecRef(pyfunc);
+ if (argv) Py_DecRef(argv);
#endif
#if defined(SWIGRUBY)
/*
Target_Type instance;
- virtual void start( const zypp::Resolvable *resolvable )
+/* virtual void start( const zypp::Resolvable *resolvable ) */
+ virtual void start( Resolvable::constPtr resolvable )
{
Target_Type r = SWIG_NewPointerObj((void *)&(*resolvable), SWIGTYPE_p_zypp__Resolvable, 0);
Target_Type result = target_call(instance, "removal_start", 1, r );
import zypp
+removals = 0
+
class CommitReceiver:
def removal_start(self, resolvable):
+ global removals
+ removals += 1
print "Starting to remove ", resolvable
class CommitCallbacksTestCase(unittest.TestCase):
for item in Z.pool():
print "Emitting removal of ", item.resolvable()
commit_callbacks_emitter.remove_start(item.resolvable())
+ print "Done"
break
+ assert removals == 1
+
commit_callbacks.disconnect()
# print "disconnected"
assert None == commit_callbacks.receiver()