Displaying 7 results from an estimated 7 matches for "py_long_long".
Did you mean:
dpy_long_long
2023 Feb 14
2
[PATCH 1/2] python: Avoid crash if callback parameters cannot be built
...3 deletions(-)
diff --git a/python/handle.c b/python/handle.c
index c8752baf47..f37e939e03 100644
--- a/python/handle.c
+++ b/python/handle.c
@@ -134,18 +134,21 @@ guestfs_int_py_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
/*...
2023 Feb 14
2
[PATCH 2/2] python: Use bytes instead of str for event callback buffer
...+++ b/python/handle.c
@@ -131,7 +131,7 @@ guestfs_int_py_event_callback_wrapper (guestfs_h *g,
}
/* XXX As with Perl we don't pass the guestfs_h handle here. */
- args = Py_BuildValue ("(Kis#O)",
+ args = Py_BuildValue ("(Kiy#O)",
(unsigned PY_LONG_LONG) event, event_handle,
buf, buf_len, py_array);
if (args == NULL) {
--
2.39.0
2023 Feb 17
3
python: Avoid leaking py_array and py_args in event callbacks
Version 1 was here:
https://listman.redhat.com/archives/libguestfs/2023-February/030732.html
Following Eric's suggestion here:
https://listman.redhat.com/archives/libguestfs/2023-February/030746.html
let's decrement the reference of py_array right after adding it to the
args. (This works even if args fails to be built).
However the other part of Eric's suggestion is wrong as
2023 Feb 17
2
[PATCH v3 0/2] python: Avoid leaking py_array and py_args in event callbacks
Version 1 was here:
https://listman.redhat.com/archives/libguestfs/2023-February/030732.html
(Ignore version 2 which had a mistake, this is version 3)
Following Eric's suggestion here:
https://listman.redhat.com/archives/libguestfs/2023-February/030746.html
let's decrement the reference of py_array right after adding it to the
args. (This works even if args fails to be built).
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
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
2023 Feb 17
1
[PATCH 1/2] python: Avoid crash if callback parameters cannot be built
...e.c
> > index c8752baf47..f37e939e03 100644
> > --- a/python/handle.c
> > +++ b/python/handle.c
> > @@ -134,18 +134,21 @@ guestfs_int_py_event_callback_wrapper (guestfs_h *g,
> > args = Py_BuildValue ("(Kis#O)",
> > (unsigned PY_LONG_LONG) event, event_handle,
> > buf, buf_len, py_array);
According to https://docs.python.org/3/c-api/arg.html#building-values,
"O" increments the count of py_array. So before the Py_BuildValue
call, py_array has a refcount of 1. I think (although the docs are...