similar to: [PATCH libnbd] python: Raise a custom exception containing error string and errno.

Displaying 20 results from an estimated 1000 matches similar to: "[PATCH libnbd] python: Raise a custom exception containing error string and errno."

2019 Jun 28
3
[PATCH libnbd v2] python: Raise a custom exception containing error string and errno.
This kind of fixes the problems in v1. The exception still primarily lives in the libnbdmod and you could still refer to it using libnbdmod.Error (but don't do that). However when the exception is printed it now appears as nbd.Error, and you can catch it also using the same name. Other problems: - There is no "nice" interface to accessing the exception fields. You have to use
2019 Jun 28
3
[PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
Following Eric's suggestions from v2, this adds .string, .errno and .__str__ properties. The .string property returns the error string. The .errno property returns the errno (from the errno module), or None. The __str__ property makes the exception nicely printable. Rich.
2019 Jun 28
0
[PATCH libnbd v2] python: Raise a custom exception containing error string and errno.
Previously errors caused a RuntimeException to be raised. This commit defines a custom exception (nbd.Error) which has two parameters, the required error string, and the optional errno (which may be 0 if unavailable). For example: $ ./run nbdsh -c 'h.pread(0, 0)' Traceback (most recent call last): File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
2019 Jun 28
0
[PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
Previously errors caused a RuntimeException to be raised. This commit defines a custom exception (nbd.Error) which has two parameters, the required error string, and the optional errno (which may be 0 if unavailable). For example: $ ./run nbdsh -c 'h.pread(0, 0)' Traceback (most recent call last): File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
2019 Jun 28
2
Re: [PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
On 6/28/19 1:27 PM, Richard W.M. Jones wrote: > Previously errors caused a RuntimeException to be raised. This commit > defines a custom exception (nbd.Error) which has two parameters, the > required error string, and the optional errno (which may be 0 if > unavailable). > > For example: > > $ ./run nbdsh -c 'h.pread(0, 0)' > Traceback (most recent call last):
2019 Aug 13
2
Re: [PATCH libnbd 5/6] generator: Implement OClosure.
On 8/13/19 5:06 AM, Richard W.M. Jones wrote: > An optional Closure parameter, but otherwise works the same way as > Closure. > @@ -3778,6 +3777,7 @@ let generate_lib_api_c () = > ) args; > List.iter ( > function > + | OClosure { cbname } -> pr ", %s_callback ? \"<fun>\" : \"NULL\"" cbname Well, it also permits a
2019 Jun 28
0
Re: [PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
On Fri, Jun 28, 2019 at 01:53:11PM -0500, Eric Blake wrote: > On 6/28/19 1:27 PM, Richard W.M. Jones wrote: > > Previously errors caused a RuntimeException to be raised. This commit > > defines a custom exception (nbd.Error) which has two parameters, the > > required error string, and the optional errno (which may be 0 if > > unavailable). > > > > For
2018 Apr 06
6
[nbdkit PATCH 0/2] Python cleanups
I noticed these while working on adding fua support into python, these are independent enough to push now (and I'll have to rebase my 'optional may_trim' patch on top of this). Eric Blake (2): python: Use Py_XDEFREF() python: Simplify calling into plugin plugins/python/python.c | 106 ++++++++---------------------------------------- 1 file changed, 18 insertions(+), 88
2019 Jun 28
1
Re: [PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
On 6/28/19 2:17 PM, Richard W.M. Jones wrote: >> >> Looks good to me now! Thanks for figuring this out while I was >> struggling with reading lots of documentation on C bindings. >> >> ACK > > I pushed it, but there may be a few issues still: > > - Still no error checking in raise_exception(). We're on an error > path already here so it's
2019 Aug 10
7
[PATCH libnbd 0/5] WIP: python: Add test for doing asynch copy.
This doesn't yet work. However it does make me more convinced than ever that we really need to sort out persistent buffer lifetimes in the library (similar to what we did for closures). Rich.
2017 May 09
1
[PATCH v2] python: add simple wrappers for PyObject<->string functions
The current need for #ifdef's based on the presence of PyString_FromString makes both the OCaml code of the generator, and the generated C code a mess to read. Hence, add three simple wrappers to make both the OCaml, and C code more readable, and easier to tweak in the future. --- generator/python.ml | 72 ++++++++++++----------------------------------------- python/handle.c | 65
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
2017 Jan 26
10
[nbdkit PATCH v2 0/6] bind .zero to Python
Fix some things I noticed while reviewing v1, and follow Rich's idea to add a new nbdkit_set_error() utility function with a binding for Python users to request a particular error (rather than being forced to live with whatever stale value is in errno after all the intermediate binding glue code). I could not easily find out how to register a C function callable from perl bindings, and have
2020 Mar 23
2
Re: [PATCH nbdkit 3/3] python: Remove extraneous static keyword
On Mon, Mar 23, 2020 at 12:28:12PM +0000, Richard W.M. Jones wrote: > From: Yifan Gu <gyf304@gmail.com> > > The create_nbdkit_module function is intended to be exported, therefore > the static keyword is not needed and prevents building on MSYS2. > --- > plugins/python/python.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git
2017 May 09
1
[PATCH] RHBZ#1406906: check return value of Python object functions
Verify the returned values of Python Object constructor functions are not NULL before adding them to a collection. This is particularly relevant when constructing Unicode strings in Python 3 as they will return NULL if non UTF-8 characters are present. Signed-off-by: Matteo Cafasso <noxdafox@gmail.com> --- generator/python.ml | 102 ++++++++++++++++++++++++++---------------
2014 Feb 03
1
[PATCH] hivex: python: value_value no longer generates Unicode strings
This fixes Github issue #2 reported by "kupiakos". <https://github.com/libguestfs/hivex/issues/2> --- generator/generator.ml | 2 +- python/t/210-setvalue.py | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/generator/generator.ml b/generator/generator.ml index 908c5f3..02aaf12 100755 --- a/generator/generator.ml +++
2019 Nov 22
18
[PATCH nbdkit v2 00/10] Implement nbdkit API v2 for Python plugins.
v1: https://www.redhat.com/archives/libguestfs/2019-November/msg00153.html v2: - Fix implementation of can_cache. - Add implementation of can_fua. - Add a very thorough test suite which tests every command + flag combination.
2017 Jan 24
4
[nbdkit PATCH 0/2] bind .zero to more languages
Begin the language binding followups to my new .zero callback, since Rich was indeed correct that we want them. I'm more familiar with python and perl (at least to the point that I was able to modify the appropriate example files and prove to myself that the bindings worked), so I've started with those. I'm less familiar with ruby and ocaml, so I've left those for tomorrow (it
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
2019 Nov 21
10
[PATCH nbdkit 0/8] Implement nbdkit API v2 for Python plugins.
And fill out most of the missing bits of the API. Rich.