Displaying 5 results from an estimated 5 matches for "pyunicode_asutf8".
2018 Apr 05
1
Re: [PATCH nbdkit] python: Turn python exceptions into nbdkit errors properly.
...++++++++++++++++++++++++++++++++++
> 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.
...nbdkit 1.16, Python >= 3.3 will be required.
Python 2 reaches end of life on 2020-01-01:
https://python3statement.org/
https://pythonclock.org/
Debian oldoldstable and RHEL 7 have Python 3.4 and 3.6 respectively,
so it seems pointless to try to support Python < 3.3 which lacked
support for PyUnicode_AsUTF8.
---
README | 13 +++++++------
configure.ac | 36 ++++++++++++++----------------------
plugins/python/python.c | 31 +------------------------------
3 files changed, 22 insertions(+), 58 deletions(-)
diff --git a/README b/README
index 187da49..9752e0b 100644
--- a/REA...
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
2018 Apr 05
0
[PATCH nbdkit] python: Turn python exceptions into nbdkit errors properly.
...in libpython.])],
[],[$PYTHON_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 10064...