Displaying 20 results from an estimated 32 matches for "py_r".
Did you mean:
pt_r
2017 May 09
1
[PATCH v2] python: add simple wrappers for PyObject<->string functions
...n
| OStringList _ ->
pr " optargs_s.%s = guestfs_int_py_get_string_list (py_%s);\n" n n;
pr " if (!optargs_s.%s) goto out;\n" n;
@@ -480,30 +456,18 @@ and generate_python_actions actions () =
| RBool _ -> pr " py_r = PyLong_FromLong ((long) r);\n"
| RInt64 _ -> pr " py_r = PyLong_FromLongLong (r);\n"
| RConstString _ ->
- pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
- pr " py_r = PyString_FromString (r);\n";
- pr "#else\n&q...
2017 May 09
0
[PATCH] python: add simple wrappers for PyObject<->string functions
...n
| OStringList _ ->
pr " optargs_s.%s = guestfs_int_py_get_string_list (py_%s);\n" n n;
pr " if (!optargs_s.%s) goto out;\n" n;
@@ -480,30 +456,18 @@ and generate_python_actions actions () =
| RBool _ -> pr " py_r = PyLong_FromLong ((long) r);\n"
| RInt64 _ -> pr " py_r = PyLong_FromLongLong (r);\n"
| RConstString _ ->
- pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
- pr " py_r = PyString_FromString (r);\n";
- pr "#else\n&q...
2015 Feb 14
0
[PATCH] python: Call PyErr_Clear() on non-error paths out of the Python bindings.
...in every
-Python binding.
-
Improvements in virt-log
------------------------
diff --git a/generator/python.ml b/generator/python.ml
index 4b823e6..637f22d 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -455,7 +455,8 @@ put_table (char * const * const argv)
pr " py_r = PyString_FromString (r);\n";
pr "#else\n";
pr " py_r = PyUnicode_FromString (r);\n";
- pr "#endif\n"
+ pr "#endif\n";
+ pr " if (py_r == NULL) goto out;\n";
| RConstOptString _ -...
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
2014 Jan 15
0
[PATCH 3/4] hivex: python: Produce Unicode strings in get_* methods
...hive_type t)
if f_len_exists name then
pr " size_t sz = hivex_%s_len (%s);\n"
name (String.concat ", " c_params);
- pr "#ifdef HAVE_PYSTRING_ASSTRING\n";
- if f_len_exists name then
- pr " py_r = PyString_FromStringAndSize (r, sz);\n"
- else
- pr " py_r = PyString_FromString (r);\n";
- pr "#else\n";
if f_len_exists name then
- pr " py_r = PyUnicode_FromStringAndSize (r, sz);\n"
+ pr &q...
2017 Mar 18
0
[PATCH] python: check return value of Python APIs
...+ 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);\n";
+ pr " if (py_r ==...
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 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;
) 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);\n";
+ pr " if (py_r ==...
2017 May 11
1
[PATCH v2] RHBZ#1406906: check return value of Python object functions
...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);\n";
+ pr " if (py_r ==...
2023 Feb 14
2
[PATCH 1/2] python: Avoid crash if callback parameters cannot be built
..._event_callback_wrapper (guestfs_h *g,
args = Py_BuildValue ("(Kis#O)",
(unsigned PY_LONG_LONG) event, event_handle,
buf, buf_len, py_array);
+ if (args == NULL) {
+ PyErr_PrintEx (0);
+ goto out;
+ }
+
Py_INCREF (args);
-
py_r = PyObject_CallObject (py_callback, args);
-
Py_DECREF (args);
-
if (py_r != NULL)
Py_DECREF (py_r);
else
/* Callback threw an exception: print it. */
PyErr_PrintEx (0);
+ out:
PyGILState_Release (py_save);
}
--
2.39.0
2014 Jan 15
4
[PATCH 1/4] hivex: Python 2.6 does not have sysconfig.
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6785037..203f34f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -329,8 +329,8 @@ AS_IF([test "x$enable_python" != "xno"],
AC_MSG_CHECKING([for Python extension suffix (PEP-3149)])
if test -z "$PYTHON_EXT_SUFFIX"; then
2017 May 09
1
[PATCH] RHBZ#1406906: check return value of Python object functions
...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);\n";
+ pr " if (py_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 Jan 22
0
[PATCH 2/2] python: change return type for RBufferOut with Python 3 (RHBZ#1661871)
...+)
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";
+ pr "#else\n";
pr " py_r = guestfs_int_py_fromstringsize (r, size);\...
2019 Jan 22
0
[PATCH v2 2/2] python: change types for RBufferOut/FBuffer with Python 3 (RHBZ#1661871)
...";
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";
+ pr "#else\n";
pr " py_r = guestfs_int_py_fromstringsize (r, size);\...
2020 Jan 09
0
[PATCH 5/7] python: replace guestfs_int_py_fromstringsize in Py2 branches
...->%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 = PyString_FromStringAndSize (r, size);\n";
pr "#endif\n";
pr "...
2014 Jan 08
5
hivex: Make node names and value names with embedded null characters accessible
On Windows, there exist at least two APIs for dealing with the
Registry: The Win32 API (RegCreateKeyA, RegCreateKeyW, etc.) works
with null-terminated ASCII or UTF-16 strings. The native API
(ZwCreateKey, etc.), on the other hand works with UTF-16 strings that
are stored as buffers+length and may contain null characters. Malware
authors have been relying on the Win32 API's inability to
2019 Nov 18
0
[PATCH] Python: Fix GIL usage in guestfs_int_py_event_callback_wrapper (RHBZ#1773520)
...f, size_t buf_len,
const uint64_t *array, size_t array_len)
{
- PyGILState_STATE py_save = PyGILState_UNLOCKED;
+ PyGILState_STATE py_save;
PyObject *py_callback = callback;
PyObject *py_array;
PyObject *args;
PyObject *a;
size_t i;
PyObject *py_r;
+ int threads_initialized = PyEval_ThreadsInitialized ();
+
+ if (threads_initialized)
+ py_save = PyGILState_Ensure ();
py_array = PyList_New (array_len);
for (i = 0; i < array_len; ++i) {
@@ -132,14 +136,8 @@ guestfs_int_py_event_callback_wrapper (guestfs_h *g,...
2011 Aug 11
2
[Hivex] [PATCH] Correct 32-bit to 64-bit call
---
generator/generator.ml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/generator/generator.ml b/generator/generator.ml
index 31478cd..de911f1 100755
--- a/generator/generator.ml
+++ b/generator/generator.ml
@@ -1771,7 +1771,7 @@ static void raise_closed (const char *) Noreturn;
pr " rv = copy_type_value (r, len, t);\n";
pr "
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