search for: py_non

Displaying 20 results from an estimated 34 matches for "py_non".

Did you mean: py_none
2014 Aug 11
3
[PATCH] python: fix possible free on uninit memory with OStringList optargs
...rator/python.ml index 72bc8a0..a763104 100644 --- a/generator/python.ml +++ b/generator/python.ml @@ -511,7 +511,9 @@ put_table (char * const * const argv) function | OBool _ | OInt _ | OInt64 _ | OString _ -> () | OStringList n -> - pr " if (py_%s != Py_None)\n" n; + let uc_n = String.uppercase n in + pr " if (py_%s != Py_None && (optargs_s.bitmask |= %s_%s_BITMASK) != 0)\n" + n c_optarg_prefix uc_n; pr " free ((char **) optargs_s.%s);\n" n ) optargs; -- 1.9.3
2019 Aug 13
1
Re: [PATCH libnbd v2 1/3] generator: Implement OClosure.
...- > 1 file changed, 46 insertions(+), 11 deletions(-) > > @@ -4394,6 +4399,16 @@ let print_python_binding name { args; optargs; ret; may_set_error } = > ) args; > List.iter ( > function > + | OClosure { cbname } -> > + pr " if (%s_user_data != Py_None) {\n" cbname; > + pr " /* Increment refcount since pointer may be saved by libnbd. */\n"; > + pr " Py_INCREF (%s_user_data);\n" cbname; > + pr " if (!PyCallable_Check (%s_user_data)) {\n" cbname; > + pr " PyE...
2017 May 09
1
[PATCH v2] python: add simple wrappers for PyObject<->string functions
...pr " PyDict_SetItemString (dict, \"%s\",\n" name; pr " PyLong_FromUnsignedLongLong (%s->%s));\n" @@ -229,15 +217,9 @@ and generate_python_structs () = pr " PyDict_SetItemString (dict, \"%s\", Py_None);\n" name; pr " }\n" | name, FChar -> - pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; pr " PyDict_SetItemString (dict, \"%s\",\n" name; - pr " PyString_FromStringAndSize (...
2017 May 09
0
[PATCH] python: add simple wrappers for PyObject<->string functions
...pr " PyDict_SetItemString (dict, \"%s\",\n" name; pr " PyLong_FromUnsignedLongLong (%s->%s));\n" @@ -229,15 +217,9 @@ and generate_python_structs () = pr " PyDict_SetItemString (dict, \"%s\", Py_None);\n" name; pr " }\n" | name, FChar -> - pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; pr " PyDict_SetItemString (dict, \"%s\",\n" name; - pr " PyString_FromStringAndSize (...
2009 Feb 24
0
any help with pyogg and pyvorbis?
...page between calls to flush or pageout!! */ static PyObject * py_ogg_stream_pageout(PyObject *self, PyObject *args) { ogg_page op; int res; if (!PyArg_ParseTuple(args, "")) return NULL; res = ogg_stream_pageout(PY_OGG_STREAM(self), &op); if (res == 0) { Py_INCREF(Py_None); return Py_None; } return py_ogg_page_from_page(&op); } And ogg_stream_pageout always returns 0, so, insufficent data has been accumulated to write a page. Can anyone help me and guess, where the fault may be. After all I've read this seems to be the right encoding procedure. S...
2015 Feb 14
0
[PATCH] python: Call PyErr_Clear() on non-error paths out of the Python bindings.
...== NULL) goto out;\n"; | RConstOptString _ -> pr " if (r) {\n"; pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; @@ -466,14 +467,16 @@ put_table (char * const * const argv) pr " } else {\n"; pr " Py_INCREF (Py_None);\n"; pr " py_r = Py_None;\n"; - pr " }\n" + pr " }\n"; + pr " if (py_r == NULL) goto out;\n"; | RString _ -> pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; pr " p...
2015 Sep 15
3
[PATCH 3/3] python: Allow bindings to be compiled with different version of libguestfs (RHBZ#1262983).
Patch to fix: https://bugzilla.redhat.com/show_bug.cgi?id=1262983 Note this won't help until the first two patches get backported to the stable branches, since <guestfs.h> won't define the necessary GUESTFS_HAVE_* macros. Rich.
2017 Mar 18
0
[PATCH] python: check return value of Python APIs
...name; + pr " return NULL;\n"; + pr " }\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; + pr " }\n"; pr " else {\n"; pr " Py_INCREF (Py_None);\n"; pr " PyDict_SetItemString (dict, \"%s\", Py_None);\n" name; pr " }\n" | name, FChar -> pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; - pr " PyDict_SetItemString (dict, \"%s\&quot...
2017 Mar 03
5
[PATCH v2 0/4] Avoid 0-bytes malloc in bindings
Hi, some of the bindings may try to malloc with 0 bytes as size when closing an handle, because there were no event handlers registered. Since this can have different behaviours in POSIX, avoid that situation altogether by just skipping allocating anything when there were no event handlers. Thanks, Pino Toscano (4): ocaml: do not try to malloc 0 elements in get_all_event_callbacks python:
2017 Apr 25
1
[Bug #1406906] [PATCH] python: fix segmentation fault when setting non UTF-8 strings
...name; + pr " return NULL;\n"; + pr " }\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; + pr " }\n"; pr " else {\n"; pr " Py_INCREF (Py_None);\n"; pr " PyDict_SetItemString (dict, \"%s\", Py_None);\n" name; pr " }\n" | name, FChar -> pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; - pr " PyDict_SetItemString (dict, \"%s\&quot...
2017 May 11
1
[PATCH v2] RHBZ#1406906: check return value of Python object functions
...pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; + pr " }\n"; pr " else {\n"; pr " Py_INCREF (Py_None);\n"; pr " PyDict_SetItemString (dict, \"%s\", Py_None);\n" name; pr " }\n" | name, FChar -> - pr " PyDict_SetItemString (dict, \"%s\",\n" name; - pr "...
2019 Aug 11
4
[PATCH libnbd v2 0/3] python: Add test for doing asynch copy.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-August/msg00103.html In v2 I've made several changes: - Fix Python callbacks so if they don't return something which is int-like, we assume they mean to return 0. - Add nbd.Buffer free() method. Read commit message in patch 2 to see what this is about. - Fixed the asynch copy test to deal with the unbelievably
2020 Sep 10
1
[libnbd PATCH] python: Fix more memory leaks
...pr " if (!h) goto out;\n"; + List.iter ( + function + | OClosure { cbname } -> + pr " %s.user_data = %s_user_data = alloc_user_data ();\n" cbname cbname; + pr " if (%s_user_data == NULL) goto out;\n" cbname; + pr " if (py_%s_fn != Py_None) {\n" cbname; + pr " if (!PyCallable_Check (py_%s_fn)) {\n" cbname; + pr " PyErr_SetString (PyExc_TypeError,\n"; + pr " \"callback parameter %s is not callable\");\n" cbname; + pr " goto ou...
2019 Aug 13
7
[PATCH libnbd v2 0/3] Implement OClosures.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-August/msg00168.html I pushed uncontroversial patches 1-4 v2: - The implementation of OClosure (new patch 1) in Python is fixed. - Patch 2 (old patch 5) is unchanged. - I added a new API for removing debug callbacks. I think this approach has some advantages over using OClosure. - I didn't yet do any work on changing the
2017 May 09
1
[PATCH] RHBZ#1406906: check return value of Python object functions
...pr " if (value == NULL)\n"; + pr " goto err;\n"; + pr " PyDict_SetItemString (dict, \"%s\", value);\n" name; + pr " }\n"; pr " else {\n"; pr " Py_INCREF (Py_None);\n"; pr " PyDict_SetItemString (dict, \"%s\", Py_None);\n" name; pr " }\n" | name, FChar -> - pr " PyDict_SetItemString (dict, \"%s\",\n" name; - pr "...
2010 Sep 09
2
[PATCH]: add libxl python binding
...y_attrib_set(ty, f): + t = py_type(f.type) + l = [] + l.append("static int py_%s_%s_set(Py_%s *self, PyObject *v, void *priv)"%(ty.rawname, f.name, ty.rawname)) + l.append("{") + if t == "Bool": + l.append(" self->obj.%s = (NULL == v || Py_None == v || Py_False == v) ? 0 : 1;"%f.name) + l.append(" return 0;") + elif t == "Uint" or t == "Int": + l.append(" %slong long tmp;"%(t == "Uint" and "unsigned " or "")) + l.append(" int...
2019 Aug 14
5
[PATCH libnbd 0/3] Use free callback to hold ref to AIO buffer.
Basically the same as this patch series, but for Python: https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html plus adding the 590 asynch test at the end. Rich.
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...allback parameter %s is not callable\");\n" cbname; pr " return NULL;\n"; @@ -4289,15 +4291,17 @@ let print_python_binding name { args; optargs; ret; may_set_error } = List.iter ( function | OClosure { cbname } -> - pr " if (%s_user_data != Py_None) {\n" cbname; + pr " if (%s.user_data != Py_None) {\n" cbname; pr " /* Increment refcount since pointer may be saved by libnbd. */\n"; - pr " Py_INCREF (%s_user_data);\n" cbname; - pr " if (!PyCallable_Check (%s_user_data)...
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 Aug 13
0
[PATCH libnbd v2 1/3] generator: Implement OClosure.
...me | OFlags (n, _) -> pr ", &%s" n ) optargs; pr "))\n"; @@ -4394,6 +4399,16 @@ let print_python_binding name { args; optargs; ret; may_set_error } = ) args; List.iter ( function + | OClosure { cbname } -> + pr " if (%s_user_data != Py_None) {\n" cbname; + pr " /* Increment refcount since pointer may be saved by libnbd. */\n"; + pr " Py_INCREF (%s_user_data);\n" cbname; + pr " if (!PyCallable_Check (%s_user_data)) {\n" cbname; + pr " PyErr_SetString (PyExc_...