]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pylibsmb: Py_BuildValue can build tuples directly
authorVolker Lendecke <vl@samba.org>
Tue, 26 Sep 2023 12:16:08 +0000 (14:16 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 4 Oct 2023 20:31:36 +0000 (20:31 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/pylibsmb.c

index deda81d16b4ef980747dedbad884847f4c66895d..9ac49437820434beee88e3d96c5552d6f5f908cb 100644 (file)
@@ -1209,26 +1209,10 @@ static PyObject *py_cli_create_ex(
                goto nomem;
        }
 
-       v = PyTuple_New(3);
-       if (v == NULL) {
-               goto nomem;
-       }
-       ret = PyTuple_SetItem(v, 0, Py_BuildValue("I", (unsigned)fnum));
-       if (ret == -1) {
-               status = NT_STATUS_INTERNAL_ERROR;
-               goto fail;
-       }
-       ret = PyTuple_SetItem(v, 1, py_cr);
-       if (ret == -1) {
-               status = NT_STATUS_INTERNAL_ERROR;
-               goto fail;
-       }
-       ret = PyTuple_SetItem(v, 2, py_create_contexts_out);
-       if (ret == -1) {
-               status = NT_STATUS_INTERNAL_ERROR;
-               goto fail;
-       }
-
+       v = Py_BuildValue("(IOO)",
+                         (unsigned)fnum,
+                         py_cr,
+                         py_create_contexts_out);
        return v;
 nomem:
        status = NT_STATUS_NO_MEMORY;