Displaying 20 results from an estimated 36 matches for "pylong_fromunsignedlong".
2019 Jul 24
2
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 2. But at
the end of the day, whether to spend more time polishing th...
2017 Mar 18
0
[PATCH] python: check return value of Python APIs
...;;
+ pr " }\n";
+ pr " PyDict_SetItemString (dict, \"%s\", value);\n" name;
| name, (FBytes|FUInt64) ->
- pr " PyDict_SetItemString (dict, \"%s\",\n" name;
- pr " PyLong_FromUnsignedLongLong (%s->%s));\n"
- typ name
+ pr " value = PyLong_FromUnsignedLongLong (%s->%s);\n" typ name;
+ pr " if (value == NULL) {\n";
+ pr " PyErr_SetString (PyExc_RuntimeError,\n";
+ pr "...
2019 Jun 25
3
[PATCH libnbd] generator: Add Mutable type to the generator.
...-> 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, \"ctypes\");\n" n n;
+...
2019 Aug 13
0
[PATCH libnbd 2/6] generator: Create only one Python wrapper per closure.
...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_PrintEx (0); return -1; }\n"...
2017 Apr 25
1
[Bug #1406906] [PATCH] python: fix segmentation fault when setting non UTF-8 strings
...;;
+ pr " }\n";
+ pr " PyDict_SetItemString (dict, \"%s\", value);\n" name;
| name, (FBytes|FUInt64) ->
- pr " PyDict_SetItemString (dict, \"%s\",\n" name;
- pr " PyLong_FromUnsignedLongLong (%s->%s));\n"
- typ name
+ pr " value = PyLong_FromUnsignedLongLong (%s->%s);\n" typ name;
+ pr " if (value == NULL) {\n";
+ pr " PyErr_SetString (PyExc_RuntimeError,\n";
+ pr "...
2017 May 11
1
[PATCH v2] RHBZ#1406906: check return value of Python object functions
...pr " goto err;\n";
+ pr " PyDict_SetItemString (dict, \"%s\", value);\n" name;
| name, (FBytes|FUInt64) ->
- pr " PyDict_SetItemString (dict, \"%s\",\n" name;
- pr " PyLong_FromUnsignedLongLong (%s->%s));\n"
- typ name
+ pr " value = PyLong_FromUnsignedLongLong (%s->%s);\n" typ name;
+ pr " if (value == NULL)\n";
+ pr " goto err;\n";
+ pr " PyDict_SetItemString (dict, \"%s...
2019 Jun 25
0
Re: [PATCH libnbd] generator: Add Mutable type to the generator.
...++++++++++++++++++--------
> 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 (py_%s_dict, \"ctypes\");\n...
2019 Jul 24
0
Re: [PATCH libnbd v2 5/5] lib: Use unsigned for pread_structured status parameter.
...gt; 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,...
2017 May 09
1
[PATCH] RHBZ#1406906: check return value of Python object functions
...pr " goto err;\n";
+ pr " PyDict_SetItemString (dict, \"%s\", value);\n" name;
| name, (FBytes|FUInt64) ->
- pr " PyDict_SetItemString (dict, \"%s\",\n" name;
- pr " PyLong_FromUnsignedLongLong (%s->%s));\n"
- typ name
+ pr " value = PyLong_FromUnsignedLongLong (%s->%s);\n" typ name;
+ pr " if (value == NULL)\n";
+ pr " goto err;\n";
+ pr " PyDict_SetItemString (dict, \"%s...
2019 Jun 29
0
[libnbd PATCH 3/6] generator: Allow Int64 in callbacks
...or 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;
pr " if (!py_%s_modnam...
2019 Jun 21
0
[libnbd PATCH v2 1/5] generator: Allow Int in callbacks
...erator
+++ 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_python_binding name { args; ret } =...
2017 May 06
5
[Bug 1406906] [PATCH 0/3] Fix segmentation fault in Python bindings
This series addresses the issue where non UTF8 file names in a guest image lead to libguestfs segfault with Python 3 APIs.
The core issue is the APIs are not checking the return value when constructing a new PyObject. Therefore NULL pointers are added to Python collections (lists and dictionaries) crashing the application.
Few notes regarding the comments on the previous patch.
- Added a
2019 Jul 24
0
[PATCH libnbd v2 5/5] lib: Use unsigned for pread_structured status parameter.
...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\");\n" n;
pr...
2019 Jun 20
1
Re: [libnbd PATCH 6/8] states: Add nbd_pread_callback API
...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
> @@ -3272,7 +3358,7 @@ let print_pyth...
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.
..."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 callbacks XXX *)
- | ArrayAndLe...
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...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_PrintEx (0); return -1; }\n"...
2019 Jun 18
0
[libnbd PATCH 6/8] states: Add nbd_pread_callback API
...uot;; 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_python_binding name { args; ret } =...
2019 Aug 12
0
[PATCH libnbd 7/7] api: Remove the valid_flag from all callbacks.
...";
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
| CBBytesIn _...
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(-)
--