search for: generate_python_actions

Displaying 20 results from an estimated 22 matches for "generate_python_actions".

2017 May 09
1
[PATCH v2] python: add simple wrappers for PyObject<->string functions
...- typ name; - pr "#endif\n" + pr " guestfs_int_py_fromstringsize (&%s->%s, 1));\n" + typ name ) cols; pr " return dict;\n"; pr "};\n"; @@ -419,13 +401,7 @@ and generate_python_actions actions () = pr " optargs_s.%s = PyLong_AsLongLong (py_%s);\n" n n; pr " if (PyErr_Occurred ()) goto out;\n" | OString _ -> - pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; - pr " optargs_s.%s...
2017 May 09
0
[PATCH] python: add simple wrappers for PyObject<->string functions
...- typ name; - pr "#endif\n" + pr " guestfs_int_py_fromstringsize (&%s->%s, 1));\n" + typ name ) cols; pr " return dict;\n"; pr "};\n"; @@ -419,13 +401,7 @@ and generate_python_actions actions () = pr " optargs_s.%s = PyLong_AsLongLong (py_%s);\n" n n; pr " if (PyErr_Occurred ()) goto out;\n" | OString _ -> - pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; - pr " optargs_s.%s...
2019 Jan 22
3
[PATCH 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. Pino Toscano (2): python: fix call of Python handlers of events python: change return type for RBufferOut with Python 3 (RHBZ#1661871) generator/python.ml | 4 ++++ python/handle.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) -- 2.20.1
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
2019 Jan 22
0
[PATCH 2/2] python: change return type for RBufferOut with Python 3 (RHBZ#1661871)
...itrary bytes, like all the ones returned by RBufferOut functions. --- generator/python.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/generator/python.ml b/generator/python.ml index a70faec8c..c10adcb69 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -511,7 +511,11 @@ and generate_python_actions actions () = pr " guestfs_int_free_string_list (r);\n"; pr " if (py_r == NULL) goto out;\n"; | RBufferOut _ -> + pr "#if PY_MAJOR_VERSION >= 3\n"; + pr " py_r = PyBytes_FromStringAndSize (r, size);\n&quo...
2019 Jan 22
0
[PATCH v2 2/2] python: change types for RBufferOut/FBuffer with Python 3 (RHBZ#1661871)
...len);\n" typ name typ name; + pr "#endif\n"; pr " if (value == NULL)\n"; pr " goto err;\n"; pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; @@ -511,7 +516,11 @@ and generate_python_actions actions () = pr " guestfs_int_free_string_list (r);\n"; pr " if (py_r == NULL) goto out;\n"; | RBufferOut _ -> + pr "#if PY_MAJOR_VERSION >= 3\n"; + pr " py_r = PyBytes_FromStringAndSize (r, size);\n&quo...
2020 Jan 09
0
[PATCH 5/7] python: replace guestfs_int_py_fromstringsize in Py2 branches
...nt_py_fromstringsize (%s->%s, %s->%s_len);\n" + pr " value = PyString_FromStringAndSize (%s->%s, %s->%s_len);\n" typ name typ name; pr "#endif\n"; pr " if (value == NULL)\n"; @@ -496,7 +496,7 @@ and generate_python_actions actions () = pr "#if PY_MAJOR_VERSION >= 3\n"; pr " py_r = PyBytes_FromStringAndSize (r, size);\n"; pr "#else\n"; - pr " py_r = guestfs_int_py_fromstringsize (r, size);\n"; + pr " py_r = PyStr...
2020 Jan 09
0
[PATCH 6/7] python: stop including config.h
...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 <config.h> - /* It is safe to call deprecated functions from this file. */ #define GUESTFS_NO_WARN_DEPRECATED #undef GUESTFS_NO_DEPRECATED @@ -542,8 +538,6 @@ and generate_python_module () = generate_header CSt...
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 Mar 18
0
[PATCH] python: check return value of Python APIs
...quot; typ name; + pr " return NULL;\n"; + pr " }\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ) cols; pr " return dict;\n"; pr "};\n"; @@ -517,16 +564,20 @@ and generate_python_actions actions () = pr " if (py_r == NULL) goto out;\n"; | RStringList _ -> pr " py_r = guestfs_int_py_put_string_list (r);\n"; - pr " guestfs_int_free_string_list (r);\n" + pr " guestfs_int_free_string_list (r);...
2017 May 21
3
[PATCH 0/2] python: improved UTF8 decoding error handling
The Python 3 bindings currently are unable to deal with non UTF8 characters. This series continues what proposed in RHBZ#1406906. A new function 'set_decode_error_handler' allows the User to specify how to deal with decoding errors. The default behaviour will be raising a UnicodeDecodeError. If the handler is changed to 'surrogateescape', non UTF8 characters will be escaped in a
2020 Jan 10
2
Re: [PATCH 6/7] python: stop including config.h
...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 <config.h> > - > /* It is safe to call deprecated functions from this file. */ > #define GUESTFS_NO_WARN_DEPRECATED > #undef GUESTFS_NO_DEPRECATED > @@ -542,8 +538,6 @@ and gener...
2017 Apr 25
1
[Bug #1406906] [PATCH] python: fix segmentation fault when setting non UTF-8 strings
...quot; typ name; + pr " return NULL;\n"; + pr " }\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; ) cols; pr " return dict;\n"; pr "};\n"; @@ -517,16 +564,20 @@ and generate_python_actions actions () = pr " if (py_r == NULL) goto out;\n"; | RStringList _ -> pr " py_r = guestfs_int_py_put_string_list (r);\n"; - pr " guestfs_int_free_string_list (r);\n" + pr " guestfs_int_free_string_list (r);...
2017 May 11
1
[PATCH v2] RHBZ#1406906: check return value of Python object functions
...e);\n" name; ) cols; pr " return dict;\n"; + pr " err:\n"; + pr " Py_CLEAR (dict);\n"; + pr " return NULL;\n"; pr "};\n"; pr "#endif\n"; pr "\n"; @@ -472,16 +498,20 @@ and generate_python_actions actions () = pr " if (py_r == NULL) goto out;\n"; | RStringList _ -> pr " py_r = guestfs_int_py_put_string_list (r);\n"; - pr " guestfs_int_free_string_list (r);\n" + pr " guestfs_int_free_string_list (r);...
2017 May 09
1
[PATCH] RHBZ#1406906: check return value of Python object functions
...e);\n" name; ) cols; pr " return dict;\n"; + pr " err:\n"; + pr " Py_CLEAR (dict);\n"; + pr " return NULL;\n"; pr "};\n"; pr "#endif\n"; pr "\n"; @@ -472,16 +498,20 @@ and generate_python_actions actions () = pr " if (py_r == NULL) goto out;\n"; | RStringList _ -> pr " py_r = guestfs_int_py_put_string_list (r);\n"; - pr " guestfs_int_free_string_list (r);\n" + pr " guestfs_int_free_string_list (r);...
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 Apr 23
8
[PATCH 0/7] Make deprecation warnings more prominent
Since there are deprecated APIs, make sure that users notice they are deprecated in more prominent ways than done so far: - using deprecated C functions now warns by default - it is possible to use the C library making sure no deprecated function is ever used - Python/Ruby/Perl scripts now get warning messages (configured according to their own systems) when deprecated functions are used The
2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...AVE_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 (struct guestfs_%s *%s)\n" typ typ typ; pr "{\n"; @@ -279,7 +280,7 @@ and generate_python_actions actions () = blocking = blocking; c_name = c_name; c_function = c_function; c_optarg_prefix = c_optarg_prefix } -> - pr "#ifdef GUESTFS_HAVE_%s\n" (String.uppercase c_name); + pr "#ifdef GUESTFS_HAVE_%s\n" (String.uppercase_ascii c_n...
2017 Apr 21
0
[PATCH 1/2] generator: Simplify the handling of string parameters.
...; guestfs_efree_stringlist (%s);\n" n; pr "\n" | Bool _ | Int _ | Int64 _ | Pointer _ -> () diff --git a/generator/python.ml b/generator/python.ml index 11dc48102..2e614b57b 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -314,15 +314,13 @@ and generate_python_actions actions () = List.iter ( function - | Pathname n | Device n | Mountable n - | Dev_or_Path n | Mountable_or_Path n | String n | Key n - | FileIn n | FileOut n | GUID n -> + | String (_, n) -> pr " const char *%s;\n" n...
2017 Apr 21
4
[PATCH 0/2] generator: Simplify the handling of string parameters.
Very large but mechanical change to the generator. Rich.