search for: pylist_set_item

Displaying 20 results from an estimated 30 matches for "pylist_set_item".

2019 Jul 24
2
Re: [PATCH libnbd v2 5/5] lib: Use unsigned for pread_structured status parameter.
...- > tests/oldstyle.c | 2 +- > 5 files changed, 39 insertions(+), 36 deletions(-) > > @@ -3789,8 +3789,8 @@ let print_python_binding name { args; ret } = > pr " for (size_t i = 0; i < %s; ++i)\n" len; > pr " PyList_SET_ITEM (py_%s, i, PyLong_FromUnsignedLong (%s[i]));\n" n n > | BytesIn _ > - | Int _ > - | Int64 _ -> () > + | Int _ > + | Int64 _ -> () A bit of churn here that could have been squashed into patch 2. But at the end of the day, whet...
2019 Jun 25
3
[PATCH libnbd] generator: Add Mutable type to the generator.
...ert false | Opaque n -> pr "void *%s" n | Path n | String n -> pr "const char *%s" n @@ -3261,14 +3265,20 @@ let print_python_binding name { args; ret } = pr " for (size_t i = 0; i < %s; ++i)\n" len; pr " PyList_SET_ITEM (py_%s, i, PyLong_FromUnsignedLong (%s[i]));\n" n n | BytesIn _ -> () + | Mutable (Int n) -> + pr " PyObject *py_%s_dict = PyImport_GetModuleDict ();\n" n; + pr " PyObject *py_%s_mod = PyMapping_GetItemString (py_%s_dict, \"ct...
2019 Aug 13
0
[PATCH libnbd 2/6] generator: Create only one Python wrapper per closure.
...D;\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_FromUnsignedLong (%s[i]));\n" n n + | CBBytesIn _ + | CBInt _ + | CBInt64 _ -> () + | CBMutable (Int n) -> + pr " PyObject *py_%s_modname = PyUnicode_FromString (\"ctypes\");\n" n; + pr " if (!py_%s_modname) { PyErr...
2019 Jun 25
0
Re: [PATCH libnbd] generator: Add Mutable type to the generator.
...or | 75 +++++++++++++++++++++++++++++++++++++-------- > 1 file changed, 63 insertions(+), 12 deletions(-) > > @@ -3261,14 +3265,20 @@ let print_python_binding name { args; ret } = > pr " for (size_t i = 0; i < %s; ++i)\n" len; > pr " PyList_SET_ITEM (py_%s, i, PyLong_FromUnsignedLong (%s[i]));\n" n n > | BytesIn _ -> () > + | Mutable (Int n) -> > + pr " PyObject *py_%s_dict = PyImport_GetModuleDict ();\n" n; > + pr " PyObject *py_%s_mod = PyMapping_GetItemString (p...
2019 Jul 24
0
Re: [PATCH libnbd v2 5/5] lib: Use unsigned for pread_structured status parameter.
...| 2 +- > > 5 files changed, 39 insertions(+), 36 deletions(-) > > > > > @@ -3789,8 +3789,8 @@ let print_python_binding name { args; ret } = > > pr " for (size_t i = 0; i < %s; ++i)\n" len; > > pr " PyList_SET_ITEM (py_%s, i, PyLong_FromUnsignedLong (%s[i]));\n" n n > > | BytesIn _ > > - | Int _ > > - | Int64 _ -> () > > + | Int _ > > + | Int64 _ -> () > > A bit of churn here that could have been squashed into patch...
2019 Jun 29
0
[libnbd PATCH 3/6] generator: Allow Int64 in callbacks
...f --git a/generator/generator b/generator/generator index 45a030f..c5988e2 100755 --- a/generator/generator +++ b/generator/generator @@ -3508,7 +3508,8 @@ let print_python_binding name { args; ret } = pr " for (size_t i = 0; i < %s; ++i)\n" len; pr " PyList_SET_ITEM (py_%s, i, PyLong_FromUnsignedLong (%s[i]));\n" n n | BytesIn _ - | Int _ -> () + | Int _ + | Int64 _ -> () | Mutable (Int n) -> pr " PyObject *py_%s_modname = PyUnicode_FromString (\"ctypes\");\n" n;...
2019 Jun 21
0
[libnbd PATCH v2 1/5] generator: Allow Int in callbacks
...100755 --- a/generator/generator +++ b/generator/generator @@ -3260,7 +3260,8 @@ let print_python_binding name { args; ret } = 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_FromUnsignedLong (%s[i]));\n" n n - | BytesIn _ -> () + | BytesIn _ + | Int _ -> () | Opaque n -> pr " struct %s_%s_data *_data = %s;\n" name cb_name n | String n @@ -3268,7 +3269,7 @@ let print_pyth...
2019 Jul 24
0
[PATCH libnbd v2 5/5] lib: Use unsigned for pread_structured status parameter.
...;error"); ]}; Closure { cbname="callback"; cbargs=[Int64 "cookie"; @@ -3789,8 +3789,8 @@ let print_python_binding name { args; ret } = pr " for (size_t i = 0; i < %s; ++i)\n" len; pr " PyList_SET_ITEM (py_%s, i, PyLong_FromUnsignedLong (%s[i]));\n" n n | BytesIn _ - | Int _ - | Int64 _ -> () + | Int _ + | Int64 _ -> () | Mutable (Int n) -> pr " PyObject *py_%s_modname = PyUnicode_FromString (\"ctypes\...
2019 Jun 20
1
Re: [libnbd PATCH 6/8] states: Add nbd_pread_callback API
...at least make them easier to review): > @@ -3264,7 +3349,8 @@ let print_python_binding name { args; ret } = > 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_FromUnsignedLong (%s[i]));\n" n n > - | BytesIn _ -> () > + | BytesIn _ > + | Int _ -> () > | Opaque n -> > pr " struct %s_%s_data *_data = %s;\n" name cb_name n > | String n > @...
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 Jun 03
0
[PATCH libnbd discussion only 4/5] api: Implement concurrent writer.
...with args = [ String "uri" ]; ret = RErr; @@ -3157,12 +3186,13 @@ let print_python_binding name { args; ret } = 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_FromUnsignedLong (%s[i]));\n" n n + | BytesIn _ -> () | Opaque n -> pr " struct %s_%s_data *_data = %s;\n" name cb_name n | String n | UInt64 n -> () (* The following not yet implemented for call...
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...+ 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; + pr " PyList_SET_ITEM (py_%s, i, PyLong_FromUnsignedLong (%s[i]));\n" n n + | BytesIn _ + | Int _ + | Int64 _ -> () + | Mutable (Int n) -> + pr " PyObject *py_%s_modname = PyUnicode_FromString (\"ctypes\");\n" n; + pr " if (!py_%s_modname) { PyErr...
2019 Jun 18
0
[libnbd PATCH 6/8] states: Add nbd_pread_callback API
...ot;); UInt64 "offset"; Flags "flags" ]; @@ -3264,7 +3349,8 @@ let print_python_binding name { args; ret } = 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_FromUnsignedLong (%s[i]));\n" n n - | BytesIn _ -> () + | BytesIn _ + | Int _ -> () | Opaque n -> pr " struct %s_%s_data *_data = %s;\n" name cb_name n | String n @@ -3272,7 +3358,7 @@ let print_pyth...
2019 Aug 12
0
[PATCH libnbd 7/7] api: Remove the valid_flag from all callbacks.
...Object *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_FromUnsignedLong (%s[i]));\n" n n + 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_FromUnsignedLong (%s[i]));\n" n...
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.
...KED;\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_FromUnsignedLong (%s[i]));\n" n n + 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_FromUnsignedLong (%s[i]));\n" n n | CBByt...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...t; 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, i, PyLong_FromUnsignedLong (%s[i]));\n" n n + 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_FromUnsignedLong (%s[i]));\n&q...
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...*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, i, PyLong_FromUnsignedLong (%s[i]));\n" n n - | BytesIn _ - | Int _ - | Int64 _ -> () - | Mutable (Int n) -> - pr " PyObject *py_%s_modname = PyUnicode_FromString (\"ctypes\");\n" n; -...
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 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...uot; 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, i, PyLong_FromUnsignedLong (%s[i]));\n" n n - | BytesIn _ - | Int _ - | Int64 _ -> () - | Mutable (Int n) -> - pr " PyObject *py_%s_modname = PyUnicode_FromString (\"ctypes\");\n" n; - pr " if (!py_%...