python: Simplify calling into plugin
PyObject_CallObject() is powerful, but awkward - we have to wrap
all arguments into a temporary tuple before using it. Furthermore,
we are failing to check for (unlikely) failure in building the
various python wrappers, which could lead to a NULL dereference
instead of a clean error message in low-memory situations.
Let python do more of the work by using PyObject_CallFunction()
anywhere that all arguments can be described by a format string,
instead of creating one-shot arguments ourselves. In fact, for
our py_config(), this makes it easier to not worry about the
difference between python 2 String vs. python 3 Unicode.
Similarly, PyObject_CallFunctionObjArgs() is nicer when we
already have PyObjects for all parameters, including in py_open(),
where we can't use a format string for converting a C int into
Py_True or Py_False, but can easily avoid the tuple wrapper.
py_zero() is not converted, as it will be changed differently
to make 'may_trim' an optional callback parameter.
Signed-off-by: Eric Blake <eblake@redhat.com>