Displaying 8 results from an estimated 8 matches for "print_python_closure_wrapper".
2019 Aug 14
5
[PATCH libnbd 0/3] Use free callback to hold ref to AIO buffer.
Basically the same as this patch series, but for Python:
https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html
plus adding the 590 asynch test at the end.
Rich.
2019 Aug 13
0
[PATCH libnbd 2/6] generator: Create only one Python wrapper per closure.
...9dbef2a..a031bd0 100755
--- a/generator/generator
+++ b/generator/generator
@@ -4108,126 +4108,122 @@ PyInit_libnbdmod (void)
}
"
+(* Functions with a Closure parameter are special because we
+ * have to generate wrapper functions which translate the
+ * callbacks back to Python.
+ *)
+let print_python_closure_wrapper { cbname; cbargs } =
+ pr "/* Wrapper for %s callback. */\n" cbname;
+ pr "static int\n";
+ pr "%s_wrapper " cbname;
+ C.print_cbarg_list cbargs;
+ pr "\n";
+ pr "{\n";
+ pr " int ret = 0;\n";
+ pr "\n";
+ pr " if...
2019 Aug 14
0
[PATCH libnbd 2/3] python: Hold a refcount to persistent AIO buffer until command completion.
---
generator/generator | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/generator/generator b/generator/generator
index f6a4856..9bcb08d 100755
--- a/generator/generator
+++ b/generator/generator
@@ -3982,6 +3982,13 @@ let print_python_closure_wrapper { cbname; cbargs } =
pr " const struct user_data *data = user_data;\n";
pr " int ret = 0;\n";
pr "\n";
+ pr " /* The C callback is always registered, even if there's no Python\n";
+ pr " * callback. This is because we may need to unr...
2019 Aug 15
13
[PATCH libnbd v2 00/10] Callbacks and OCaml and Python persistent buffers.
This is a combination of these two earlier series:
https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html
https://www.redhat.com/archives/libguestfs/2019-August/msg00240.html
plus changes to allow .callback = NULL / .free != NULL, and to reduce
the complexity of freeing callbacks.
Although it's rather long there's nothing complex here. We might
consider squashing some
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...;
- pr "#define LIBNBD_CALLBACK_VALID 1\n";
- pr "#define LIBNBD_CALLBACK_FREE 2\n";
- pr "\n";
pr "extern struct nbd_handle *nbd_create (void);\n";
pr "#define LIBNBD_HAVE_NBD_CREATE 1\n";
pr "\n";
@@ -4032,26 +4025,25 @@ let print_python_closure_wrapper { cbname; cbargs } =
pr "{\n";
pr " int ret = 0;\n";
pr "\n";
- pr " if (valid_flag & LIBNBD_CALLBACK_VALID) {\n";
- pr " PyGILState_STATE py_save = PyGILState_UNLOCKED;\n";
- pr " PyObject *py_args, *py_ret;\n";
+...
2020 Sep 08
2
[libnbd PATCH] python: Plug some memory leaks on error paths
...e process.
---
generator/Python.ml | 55 +++++++++++++++++++++++++++++----------------
1 file changed, 36 insertions(+), 19 deletions(-)
diff --git a/generator/Python.ml b/generator/Python.ml
index 4a96cf6..9a22f9e 100644
--- a/generator/Python.ml
+++ b/generator/Python.ml
@@ -177,6 +177,7 @@ let print_python_closure_wrapper { cbname; cbargs } =
pr " Py_DECREF (py_%s_modname);\n" n;
pr " if (!py_%s_mod) { PyErr_PrintEx (0); return -1; }\n" n;
pr " PyObject *py_%s = PyObject_CallMethod (py_%s_mod, \"c_int\", \"i\", *%s);\n" n n n;
+ pr &q...
2019 Aug 13
12
[PATCH 0/6] Implement OClosure.
Patches 1-4 are basically uncontroversial, straightforward refactoring
and IMHO we should just push them. Possibly 1-3 should be squashed
together, but I posted them separately so they are easier to review.
Patches 5 and 6 together implement OClosure. Patch 5 adds the feature
and is simple to understand.
Patch 6 changes the Closure completion callbacks into OClosure, but
because it doesn't
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass
closures + user_data + free function in single struct parameters as I
described previously in this email:
https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html
Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile
simplification if you buy into 1 & 2.
Patch 4 adds another macro which is