Displaying 3 results from an estimated 3 matches for "8b3d08c".
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
2017 Jan 26
0
[nbdkit PATCH v2 5/6] python: Expose nbdkit_set_error to python script
...plugins/python/nbdkit-python-plugin.pod | 27 +++++++++++++++++++++++----
plugins/python/python.c | 18 ++++++++++++++++++
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/plugins/python/nbdkit-python-plugin.pod b/plugins/python/nbdkit-python-plugin.pod
index 9b0f0ef..8b3d08c 100644
--- a/plugins/python/nbdkit-python-plugin.pod
+++ b/plugins/python/nbdkit-python-plugin.pod
@@ -63,9 +63,22 @@ does not need to be executable. In fact it's a good idea not to do
that, because running the plugin directly as a Python script won't
work.
+=head2 METHODS
+
+Your scrip...
2017 Jan 26
0
[nbdkit PATCH v2 6/6] python: Support zero callback
...(h, count, offset, may_trim):
+ global disk
+ if may_trim:
+ disk[offset:offset+count] = bytearray(count)
+ else:
+ nbdkit.set_error(errno.EOPNOTSUPP)
+ raise Exception
diff --git a/plugins/python/nbdkit-python-plugin.pod b/plugins/python/nbdkit-python-plugin.pod
index 8b3d08c..b78c0e2 100644
--- a/plugins/python/nbdkit-python-plugin.pod
+++ b/plugins/python/nbdkit-python-plugin.pod
@@ -215,6 +215,26 @@ The body of your C<trim> function should "punch a hole" in the
backing store. If the trim fails, your function should throw an
exception, optionally us...