summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/python/py_spoolss_forms_conv.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source3/python/py_spoolss_forms_conv.c b/source3/python/py_spoolss_forms_conv.c
index 604777adcd..1b006cbf51 100644
--- a/source3/python/py_spoolss_forms_conv.c
+++ b/source3/python/py_spoolss_forms_conv.c
@@ -55,16 +55,21 @@ BOOL py_from_FORM_1(PyObject **dict, FORM_1 *form)
BOOL py_to_FORM(FORM *form, PyObject *dict)
{
- PyObject *obj;
+ PyObject *obj, *dict_copy = PyDict_Copy(dict);
char *name;
- if (!to_struct(form, dict, py_FORM))
- return False;
-
if (!(obj = PyDict_GetItemString(dict, "name")) ||
!PyString_Check(obj))
return False;
+ PyDict_DelItemString(dict_copy, "level");
+ PyDict_DelItemString(dict_copy, "name");
+
+ if (!to_struct(form, dict_copy, py_FORM)) {
+ Py_DECREF(dict_copy);
+ return False;
+ }
+
name = PyString_AsString(obj);
init_unistr2(&form->name, name, strlen(name) + 1);