search for: py_args

Displaying 20 results from an estimated 38 matches for "py_args".

2019 Aug 13
0
[PATCH libnbd 2/6] generator: Create only one Python wrapper per closure.
...C.print_cbarg_list cbargs; + pr "\n"; + 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"; + List.iter ( + function + | CBArrayAndLen (UInt32 n, len) -> + pr " PyObject *py_%s = PyList_New (%s);\n" n len; + pr " for (size_t i = 0; i < %s; ++i)\n" len; + pr " PyList_SET_ITEM (py_%s, i, PyLong_FromUnsigne...
2023 Feb 17
3
python: Avoid leaking py_array and py_args in event callbacks
Version 1 was here: https://listman.redhat.com/archives/libguestfs/2023-February/030732.html Following Eric's suggestion here: https://listman.redhat.com/archives/libguestfs/2023-February/030746.html let's decrement the reference of py_array right after adding it to the args. (This works even if args fails to be built). However the other part of Eric's suggestion is wrong as
2023 Feb 17
2
[PATCH v3 0/2] python: Avoid leaking py_array and py_args in event callbacks
Version 1 was here: https://listman.redhat.com/archives/libguestfs/2023-February/030732.html (Ignore version 2 which had a mistake, this is version 3) Following Eric's suggestion here: https://listman.redhat.com/archives/libguestfs/2023-February/030746.html let's decrement the reference of py_array right after adding it to the args. (This works even if args fails to be built).
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...pr "%s_%s_wrapper " name cb.name; + print_c_arg_list ~handle:(Some "void *_data") cb.cbargs; + pr "\n"; + pr "{\n"; + pr " int ret;\n"; + pr " PyGILState_STATE py_save = PyGILState_UNLOCKED;\n"; + pr " PyObject *py_args, *py_ret;\n"; + pr " struct %s_data *data = _data;\n" name; + List.iter ( + function + | ArrayAndLen (UInt32 n, len) -> + pr " PyObject *py_%s = PyList_New (%s);\n" n len; + pr " for (size_t i = 0; i < %s; ++i)\n" len; +...
2019 Aug 12
0
[PATCH libnbd 7/7] api: Remove the valid_flag from all callbacks.
...t; may_set_error } = 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"; + pr " PyGILState_STATE py_save = PyGILState_UNLOCKED;\n"; + pr " PyObject *py_args, *py_ret;\n"; List.iter ( function | CBArrayAndLen (UInt32 n, len) -> - pr " PyObject *py_%s = PyList_New (%s);\...
2019 Jul 16
3
[RFC libnbd PATCH 0/2] Start fixing python nbd.pread_structured_callback
Posting now that I got something to compile (at the expense of breaking OCaml bindings), but I'm open to ideas on how to improve it. Eric Blake (2): generator: Tweak print_c_arg_list to take alternate first arg RFC: generator: Handle shared callbacks in Python generator/generator | 556 ++++++++++++++++++++++---------------------- 1 file changed, 280 insertions(+), 276 deletions(-) --
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...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"; + pr " PyGILState_STATE py_save = PyGILState_UNLOCKED;\n"; + pr " PyObject *py_args, *py_ret;\n"; List.iter ( function | CBArrayAndLen (UInt32 n, len) -> - pr " PyObject *py_%s = PyList_New (%s);\n" n len; - pr &quo...
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...;; + pr "%s_%s_wrapper " name cbname; + C.print_arg_list ~user_data:true cbargs; + pr "\n"; + pr "{\n"; + pr " int ret;\n"; + pr " PyGILState_STATE py_save = PyGILState_UNLOCKED;\n"; + pr " PyObject *py_args, *py_ret;\n"; List.iter ( - fun { cbname; cbargs } -> - pr "static int\n"; - pr "%s_%s_wrapper " name cbname; - C.print_arg_list ~user_data:true cbargs; - pr "\n"; - pr "{\n"; -...
2019 Aug 10
1
Re: [PATCH libnbd 2/5] python: Allow Python callbacks to auto-retire by returning an integer.
...orrect: > diff --git a/generator/generator b/generator/generator > index 0107724..0523f0a 100755 > --- a/generator/generator > +++ b/generator/generator > @@ -4135,7 +4135,8 @@ let print_python_binding name { args; optargs; ret; may_set_error } = > pr " Py_DECREF (py_args);\n"; > pr "\n"; > pr " if (py_ret != NULL) {\n"; > - pr " Py_DECREF (py_ret); /* return value is discarded */\n"; > + pr " ret = PyLong_AsLong (py_ret);\n"; > + pr " Py_DECREF (py_r...
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 Jul 24
8
[PATCH libnbd v2 0/5] lib: Implement closure lifetimes.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-July/thread.html#00231 The changes address everything that Eric picked up in his review of the first two patches. I have also added two more patches (4 and 5) which respectively fix docs and change int status -> unsigned status, as discussed. Passes make, check, check-valgrind. Rich.
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...int_arg_list ~user_data:true cbargs; + C.print_arg_list ~valid_flag:true ~user_data:true cbargs; pr "\n"; pr "{\n"; - pr " int ret;\n"; - pr " PyGILState_STATE py_save = PyGILState_UNLOCKED;\n"; - pr " PyObject *py_args, *py_ret;\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";...
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...static int\n"; - pr "%s_%s_wrapper " name cb_name; - print_c_arg_list args; - pr "\n"; - pr "{\n"; - pr " int ret;\n"; - pr " PyGILState_STATE py_save = PyGILState_UNLOCKED;\n"; - pr " PyObject *py_args, *py_ret;\n"; - List.iter ( - function - | ArrayAndLen (UInt32 n, len) -> - pr " PyObject *py_%s = PyList_New (%s);\n" n len; - pr " for (size_t i = 0; i < %s; ++i)\n" len; - pr " PyList_SET_ITEM (py_%s,...
2019 Jul 24
2
Re: [PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...> - ) cls; > - pr " free (user_data);\n"; > + pr " Py_DECREF (user_data);\n"; > pr "}\n"; > pr "\n"; > ); ... (lots of churn due to reindentation, such is life) > + pr " py_args = Py_BuildValue (\"(\""; > + List.iter ( > + function > + | ArrayAndLen (UInt32 n, len) -> pr " \"O\"" > + | BytesIn (n, len) -> pr " \"y#\"" > + | Int n -> pr " \"i\"...
2019 Jul 16
2
[PATCH libnbd v2] generator: Define new Closure type
As before, but this one has working Python bindings. OCaml still TBD. Rich.
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 Jun 04
0
[PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
...static int\n"; pr "%s_%s_wrapper " name cb_name; print_c_arg_list args; pr "\n"; pr "{\n"; + pr " int ret;\n"; pr " PyGILState_STATE py_save = PyGILState_UNLOCKED;\n"; pr " PyObject *py_args, *py_ret;\n"; List.iter ( @@ -3213,10 +3214,14 @@ let print_python_binding name { args; ret } = pr "\n"; pr " Py_DECREF (py_args);\n"; pr "\n"; - pr " if (py_ret != NULL)\n"; + pr " if (py_ret != NULL)...
2019 Jul 24
6
[PATCH libnbd 0/3] Implement closure lifetimes.
This implements most of what I wrote here: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html
2019 Aug 12
14
[PATCH libnbd 0/7] Add free callbacks and remove valid_flag.
As proposed here: https://www.redhat.com/archives/libguestfs/2019-August/msg00130.html I didn't actually read Eric's replies to that yet because I've been concentrating on writing these patches all day. Anyway here they are and I'll look at what Eric said about the proposal next. Rich.
2019 Aug 11
4
[PATCH libnbd v2 0/3] python: Add test for doing asynch copy.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-August/msg00103.html In v2 I've made several changes: - Fix Python callbacks so if they don't return something which is int-like, we assume they mean to return 0. - Add nbd.Buffer free() method. Read commit message in patch 2 to see what this is about. - Fixed the asynch copy test to deal with the unbelievably