search for: generate_python_structs

Displaying 17 results from an estimated 17 matches for "generate_python_structs".

2020 Apr 20
2
[PATCH] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...field. Signed-off-by: Sam Eiderman <sameid@google.com> --- generator/python.ml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/generator/python.ml b/generator/python.ml index f0d6b5d96..7394a943a 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -170,6 +170,14 @@ and generate_python_structs () = function | name, FString -> pr " value = guestfs_int_py_fromstring (%s->%s);\n" typ name; + (match typ, name with + | "application", "app_description" + | "application2", "app2_d...
2017 May 09
1
[PATCH v2] python: add simple wrappers for PyObject<->string functions
...yObject *guestfs_int_py_put_table (char * const * const argv); +extern PyObject *guestfs_int_py_fromstring (const char *str); +extern PyObject *guestfs_int_py_fromstringsize (const char *str, size_t size); +extern char *guestfs_int_py_asstring (PyObject *obj); "; @@ -178,31 +181,16 @@ and generate_python_structs () = function | name, FString -> pr " PyDict_SetItemString (dict, \"%s\",\n" name; - pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; - pr " PyString_FromString (%s->%s));\n" -...
2017 Apr 25
1
[Bug #1406906] [PATCH] python: fix segmentation fault when setting non UTF-8 strings
...generator/python.ml | 143 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 97 insertions(+), 46 deletions(-) diff --git a/generator/python.ml b/generator/python.ml index 11dc48102..7d86131b1 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -152,12 +152,20 @@ and generate_python_structs () = pr "PyObject *\n"; pr "guestfs_int_py_put_%s_list (struct guestfs_%s_list *%ss)\n" typ typ typ; pr "{\n"; - pr " PyObject *list;\n"; + pr " PyObject *list, *element;\n"; pr " size_t i;\n"; pr "\n...
2020 Jan 09
9
[PATCH 0/7] Various Python cleanups.
Patch #7 depends on: https://www.redhat.com/archives/libguestfs/2020-January/msg00035.html No, Python < 3 support is not dropped yet, however it will be easier after this series. Pino Toscano (7): build: enforce a minimum Python version python: drop code for Python < 2.5 python: assume support for Capsules python: remove compile time check for PyString_AsString python: replace
2017 May 09
0
[PATCH] python: add simple wrappers for PyObject<->string functions
...yObject *guestfs_int_py_put_table (char * const * const argv); +extern PyObject *guestfs_int_py_fromstring (const char *str); +extern PyObject *guestfs_int_py_fromstringsize (const char *str, size_t size); +extern char *guestfs_int_py_asstring (PyObject *obj); "; @@ -178,31 +181,16 @@ and generate_python_structs () = function | name, FString -> pr " PyDict_SetItemString (dict, \"%s\",\n" name; - pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; - pr " PyString_FromString (%s->%s));\n" -...
2017 Mar 18
0
[PATCH] python: check return value of Python APIs
...generator/python.ml | 143 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 97 insertions(+), 46 deletions(-) diff --git a/generator/python.ml b/generator/python.ml index 11dc48102..d03275276 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -152,12 +152,20 @@ and generate_python_structs () = pr "PyObject *\n"; pr "guestfs_int_py_put_%s_list (struct guestfs_%s_list *%ss)\n" typ typ typ; pr "{\n"; - pr " PyObject *list;\n"; + pr " PyObject *list, *element;\n"; pr " size_t i;\n"; pr "\n...
2017 May 11
1
[PATCH v2] RHBZ#1406906: check return value of Python object functions
...57 +++++++++++++++++++++++ 3 files changed, 152 insertions(+), 43 deletions(-) create mode 100644 python/t/test830RHBZ1406906.py diff --git a/generator/python.ml b/generator/python.ml index cf0829489..4cae24757 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -155,12 +155,20 @@ and generate_python_structs () = pr "PyObject *\n"; pr "guestfs_int_py_put_%s_list (struct guestfs_%s_list *%ss)\n" typ typ typ; pr "{\n"; - pr " PyObject *list;\n"; + pr " PyObject *list, *element;\n"; pr " size_t i;\n"; pr "\n...
2019 Jan 22
0
[PATCH v2 2/2] python: change types for RBufferOut/FBuffer with Python 3 (RHBZ#1661871)
...the only way to handle safely sequences of arbitrary bytes. --- generator/python.ml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/generator/python.ml b/generator/python.ml index a70faec8c..bc5af528c 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -195,8 +195,13 @@ and generate_python_structs () = pr " goto err;\n"; pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; | name, FBuffer -> + pr "#if PY_MAJOR_VERSION >= 3\n"; + pr " value = PyBytes_FromStringAndSize (%s->...
2020 Jan 09
0
[PATCH 5/7] python: replace guestfs_int_py_fromstringsize in Py2 branches
...String_FromStringAndSize anyway on Python < 3). --- generator/python.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generator/python.ml b/generator/python.ml index 2a1a48fc0..0e1ed20d8 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -178,7 +178,7 @@ and generate_python_structs () = pr " value = PyBytes_FromStringAndSize (%s->%s, %s->%s_len);\n" typ name typ name; pr "#else\n"; - pr " value = guestfs_int_py_fromstringsize (%s->%s, %s->%s_len);\n" + pr " value =...
2020 Jan 09
0
[PATCH 6/7] python: stop including config.h
...ure, and gnulib is not used already. --- generator/python.ml | 6 ------ python/handle.c | 2 -- 2 files changed, 8 deletions(-) diff --git a/generator/python.ml b/generator/python.ml index 0e1ed20d8..fd297321e 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -119,8 +119,6 @@ and generate_python_structs () = generate_header CStyle LGPLv2plus; pr "\ -#include <config.h> - #include <stdio.h> #include <stdlib.h> #include <assert.h> @@ -251,8 +249,6 @@ and generate_python_actions actions () = generate_header CStyle LGPLv2plus; pr "\ -#include <co...
2020 Apr 20
0
[PATCH] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...field. Signed-off-by: Sam Eiderman <sameid@google.com> --- generator/python.ml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/generator/python.ml b/generator/python.ml index f0d6b5d96..7394a943a 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -170,6 +170,14 @@ and generate_python_structs () = function | name, FString -> pr " value = guestfs_int_py_fromstring (%s->%s);\n" typ name; + (match typ, name with + | "application", "app_description" + | "application2", "app2_d...
2020 Apr 20
0
Re: [PATCH] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...d@google.com> > --- > generator/python.ml | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/generator/python.ml b/generator/python.ml > index f0d6b5d96..7394a943a 100644 > --- a/generator/python.ml > +++ b/generator/python.ml > @@ -170,6 +170,14 @@ and generate_python_structs () = > function > | name, FString -> > pr " value = guestfs_int_py_fromstring (%s->%s);\n" typ name; > + (match typ, name with > + | "application", "app_description" > + | "ap...
2019 Jan 22
3
[PATCH v2 0/2] python: fixes for Python 3
A couple of fixes for Python 3 to the Python binding. Unfortunately a behaviour change is needed, although it fixes broken types used. Changes from v1: - handle also FBuffer in structs Pino Toscano (2): python: fix call of Python handlers of events python: change types for RBufferOut/FBuffer with Python 3 (RHBZ#1661871) generator/python.ml | 9 +++++++++ python/handle.c | 3 ++- 2
2017 May 09
1
[PATCH] RHBZ#1406906: check return value of Python object functions
...| 51 +++++++++++++++++++++ 3 files changed, 145 insertions(+), 42 deletions(-) create mode 100644 python/t/test830RHBZ1406906.py diff --git a/generator/python.ml b/generator/python.ml index cf0829489..4cae24757 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -155,12 +155,20 @@ and generate_python_structs () = pr "PyObject *\n"; pr "guestfs_int_py_put_%s_list (struct guestfs_%s_list *%ss)\n" typ typ typ; pr "{\n"; - pr " PyObject *list;\n"; + pr " PyObject *list, *element;\n"; pr " size_t i;\n"; pr "\n...
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
2020 Jan 10
2
Re: [PATCH 6/7] python: stop including config.h
...header shouldn't be used for PyPi and shouldn't need to be bundled (so patch #7 would be OK). Rich. > diff --git a/generator/python.ml b/generator/python.ml > index 0e1ed20d8..fd297321e 100644 > --- a/generator/python.ml > +++ b/generator/python.ml > @@ -119,8 +119,6 @@ and generate_python_structs () = > generate_header CStyle LGPLv2plus; > > pr "\ > -#include <config.h> > - > #include <stdio.h> > #include <stdlib.h> > #include <assert.h> > @@ -251,8 +249,6 @@ and generate_python_actions actions () = > generate_header C...
2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...case c_name); + pr "#ifdef GUESTFS_HAVE_%s\n" (String.uppercase_ascii c_name); pr "extern PyObject *guestfs_int_py_%s (PyObject *self, PyObject *args);\n" name; pr "#endif\n" ) (actions |> external_functions |> sort); @@ -147,7 +148,7 @@ and generate_python_structs () = "; let emit_put_list_function typ = - pr "#ifdef GUESTFS_HAVE_STRUCT_%s\n" (String.uppercase typ); + pr "#ifdef GUESTFS_HAVE_STRUCT_%s\n" (String.uppercase_ascii typ); pr "PyObject *\n"; pr "guestfs_int_py_put_%s_list (struct guestf...