diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-11-30 19:50:25 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-11-30 19:50:25 (GMT) |
commit | 23abef53590bf3dd6f88ff4dbe81e306abfa4386 (patch) | |
tree | 5e7178e9455d38e14f401f44b3074079e73ebf86 /plugins/elf | |
parent | 7fd6e0b76f33de5934fad17efb75366904a3875b (diff) |
Marked some arguments as optional for loading formats with Python.
Diffstat (limited to 'plugins/elf')
-rw-r--r-- | plugins/elf/python/format.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/elf/python/format.c b/plugins/elf/python/format.c index eb1bedb..a5e93d7 100644 --- a/plugins/elf/python/format.c +++ b/plugins/elf/python/format.c @@ -73,9 +73,19 @@ static PyObject *py_elf_format_new(PyTypeObject *type, PyObject *args, PyObject GtkStatusStack *status; /* Instance GTK de suivi */ GBinFormat *format; /* Création GLib à transmettre */ - ret = PyArg_ParseTuple(args, "O!OO", get_python_binary_content_type(), &content_obj, &parent_obj, &status_obj); + parent_obj = Py_None; + status_obj = Py_None; + + ret = PyArg_ParseTuple(args, "O|OO", &content_obj, &parent_obj, &status_obj); if (!ret) return NULL; + ret = PyObject_IsInstance(content_obj, (PyObject *)get_python_binary_content_type()); + if (!ret) + { + PyErr_SetString(PyExc_TypeError, _("The first argument must be an instance of BinContent.")); + return NULL; + } + content = G_BIN_CONTENT(pygobject_get(content_obj)); if (parent_obj == Py_None) |