Displaying 5 results from an estimated 5 matches for "have_pyunicode_asutf8".
2018 Apr 05
1
Re: [PATCH nbdkit] python: Turn python exceptions into nbdkit errors properly.
...| 42 ++++++++++++++++++++++++++++++++++
> 5 files changed, 144 insertions(+), 3 deletions(-)
>
> +/* Convert bytes/str/unicode into a string. Caller must free. */
> +static char *
> +python_to_string (PyObject *str)
> +{
> + char *r;
> +
> + if (str) {
> +#ifdef HAVE_PYUNICODE_ASUTF8
> + if (PyUnicode_Check (str)) {
> + r = PyUnicode_AsUTF8 (str);
> + r = strdup (r);
> + return r;
Any simpler to just write:
return strdup (PyUnicode_AsUTF8 (str));
instead of using the temporary variable r?
> static int
> check_python_failure (const char...
2018 Apr 05
4
[PATCH nbdkit] python: Turn python exceptions into nbdkit errors
Much more annoying that it needs to be, but I have tested it and it
works on Python 2 & 3. Note this will not work on Python 3.0 - 3.2,
but I guess we don't care about those versions.
Rich.
2019 Sep 11
0
[PATCH nbdkit] python: Drop support for Python 2.
...BLDLIBRARY])
- AC_CHECK_LIB([c],[PyString_AsString],
- [AC_DEFINE([HAVE_PYSTRING_ASSTRING],1,
- [Found PyString_AsString in libpython.])],
- [],[$PYTHON_BLDLIBRARY])
- AC_CHECK_LIB([c],[PyUnicode_AsUTF8],
- [AC_DEFINE([HAVE_PYUNICODE_ASUTF8],1,
- [Found PyUnicode_AsUTF8 in libpython.])],
- [],[$PYTHON_BLDLIBRARY])
-
- LIBS="$old_LIBS"
-
])
AM_CONDITIONAL([HAVE_PYTHON],[test "x$enable_python" != "xno" && test "x$PYTHON" != "xno"])...
2018 Apr 05
0
[PATCH nbdkit] python: Turn python exceptions into nbdkit errors properly.
...BLDLIBRARY])
+ AC_CHECK_LIB([c],[PyString_AsString],
+ [AC_DEFINE([HAVE_PYSTRING_ASSTRING],1,
+ [Found PyString_AsString in libpython.])],
+ [],[$PYTHON_BLDLIBRARY])
+ AC_CHECK_LIB([c],[PyUnicode_AsUTF8],
+ [AC_DEFINE([HAVE_PYUNICODE_ASUTF8],1,
+ [Found PyUnicode_AsUTF8 in libpython.])],
+ [],[$PYTHON_BLDLIBRARY])
LIBS="$old_LIBS"
diff --git a/plugins/python/python.c b/plugins/python/python.c
index 83a32ea..02f0d4c 100644
--- a/plugins/python/python.c
+++ b/plugins/python/p...
2019 Sep 11
3
[PATCH nbdkit] python: Drop support for Python 2.
This patch proposes to drop support for Python 2 in nbdkit.
Rather than abruptly drop it everywhere, my proposal is that we point
people to nbdkit 1.14 (the current stable version) if they want to
continue with Python 2 plugins, while gently reminding them of the
upcoming Python 2.7 end of life announcement.
Libnbd never supported Python 2. Libguestfs in theory supports
Python 2 but I dropped