Displaying 20 results from an estimated 22 matches for "py_major_version".
Did you mean:
i_major_version
2020 Apr 26
5
[PATCH v3] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...ameid@google.com>
---
python/handle.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/python/handle.c b/python/handle.c
index 2fb8c18f0..fe89dc58a 100644
--- a/python/handle.c
+++ b/python/handle.c
@@ -387,7 +387,7 @@ guestfs_int_py_fromstring (const char *str)
#if PY_MAJOR_VERSION < 3
return PyString_FromString (str);
#else
- return PyUnicode_FromString (str);
+ return guestfs_int_py_fromstringsize (str, strlen (str));
#endif
}
@@ -397,7 +397,12 @@ guestfs_int_py_fromstringsize (const char *str, size_t size)
#if PY_MAJOR_VERSION < 3
return PyString_FromSt...
2020 Apr 20
4
[PATCH v2] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...<sameid@google.com>
---
python/handle.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/handle.c b/python/handle.c
index 2fb8c18f0..427424707 100644
--- a/python/handle.c
+++ b/python/handle.c
@@ -387,7 +387,7 @@ guestfs_int_py_fromstring (const char *str)
#if PY_MAJOR_VERSION < 3
return PyString_FromString (str);
#else
- return PyUnicode_FromString (str);
+ return PyUnicode_Decode(str, strlen(str), "utf-8", "replace");
#endif
}
@@ -397,7 +397,7 @@ guestfs_int_py_fromstringsize (const char *str, size_t size)
#if PY_MAJOR_VERSION < 3...
2020 Jun 30
3
Re: [PATCH v3] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...a reproducer I can actually try freely?
>
> > diff --git a/python/handle.c b/python/handle.c
> > index 2fb8c18f0..fe89dc58a 100644
> > --- a/python/handle.c
> > +++ b/python/handle.c
> > @@ -387,7 +387,7 @@ guestfs_int_py_fromstring (const char *str)
> > #if PY_MAJOR_VERSION < 3
> > return PyString_FromString (str);
> > #else
> > - return PyUnicode_FromString (str);
> > + return guestfs_int_py_fromstringsize (str, strlen (str));
> > #endif
> > }
> >
> > @@ -397,7 +397,12 @@ guestfs_int_py_fromstringsize (const...
2020 Jun 03
2
Re: [PATCH v3] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...ed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/python/handle.c b/python/handle.c
> > index 2fb8c18f0..fe89dc58a 100644
> > --- a/python/handle.c
> > +++ b/python/handle.c
> > @@ -387,7 +387,7 @@ guestfs_int_py_fromstring (const char *str)
> > #if PY_MAJOR_VERSION < 3
> > return PyString_FromString (str);
> > #else
> > - return PyUnicode_FromString (str);
> > + return guestfs_int_py_fromstringsize (str, strlen (str));
> > #endif
> > }
> >
> > @@ -397,7 +397,12 @@ guestfs_int_py_fromstringsize (const...
2019 Sep 11
0
[PATCH nbdkit] python: Drop support for Python 2.
...name = PyString_FromString ("traceback");
-#else
module_name = PyUnicode_FromString ("traceback");
-#endif
traceback_module = PyImport_Import (module_name);
Py_DECREF (module_name);
@@ -222,7 +210,6 @@ check_python_failure (const char *callback)
return 0;
}
-#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"nbdkit",
@@ -234,25 +221,18 @@ static struct PyModuleDef moduledef = {
NULL,
NULL
};
-#endif
static PyMODINIT_FUNC
create_nbdkit_module (void)
{
PyObject *m;
-#if PY_MAJOR_VERSION >= 3
m...
2020 Jan 09
9
[PATCH 0/7] Various Python cleanups.
Patch #7 depends on:
https://www.redhat.com/archives/libguestfs/2020-January/msg00035.html
No, Python < 3 support is not dropped yet, however it will be easier
after this series.
Pino Toscano (7):
build: enforce a minimum Python version
python: drop code for Python < 2.5
python: assume support for Capsules
python: remove compile time check for PyString_AsString
python: replace
2019 Jan 22
0
[PATCH v2 2/2] python: change types for RBufferOut/FBuffer with Python 3 (RHBZ#1661871)
...--- a/generator/python.ml
+++ b/generator/python.ml
@@ -195,8 +195,13 @@ and generate_python_structs () =
pr " goto err;\n";
pr " PyDict_SetItemString (dict, \"%s\", value);\n" name;
| name, FBuffer ->
+ pr "#if PY_MAJOR_VERSION >= 3\n";
+ pr " value = PyBytes_FromStringAndSize (%s->%s, %s->%s_len);\n"
+ typ name typ name;
+ pr "#else\n";
pr " value = guestfs_int_py_fromstringsize (%s->%s, %s->%s_len);\n"
typ...
2020 Apr 20
0
Re: [PATCH v2] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...ndle.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/python/handle.c b/python/handle.c
> index 2fb8c18f0..427424707 100644
> --- a/python/handle.c
> +++ b/python/handle.c
> @@ -387,7 +387,7 @@ guestfs_int_py_fromstring (const char *str)
> #if PY_MAJOR_VERSION < 3
> return PyString_FromString (str);
> #else
> - return PyUnicode_FromString (str);
> + return PyUnicode_Decode(str, strlen(str), "utf-8", "replace");
> #endif
> }
>
> @@ -397,7 +397,7 @@ guestfs_int_py_fromstringsize (const char *str, siz...
2020 Apr 23
0
Re: [PATCH v2] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...andle.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/python/handle.c b/python/handle.c
> index 2fb8c18f0..427424707 100644
> --- a/python/handle.c
> +++ b/python/handle.c
> @@ -387,7 +387,7 @@ guestfs_int_py_fromstring (const char *str)
> #if PY_MAJOR_VERSION < 3
> return PyString_FromString (str);
> #else
> - return PyUnicode_FromString (str);
> + return PyUnicode_Decode(str, strlen(str), "utf-8", "replace");
> #endif
> }
>
> @@ -397,7 +397,7 @@ guestfs_int_py_fromstringsize (const char *str, size_...
2020 May 13
0
Re: [PATCH v3] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/python/handle.c b/python/handle.c
> index 2fb8c18f0..fe89dc58a 100644
> --- a/python/handle.c
> +++ b/python/handle.c
> @@ -387,7 +387,7 @@ guestfs_int_py_fromstring (const char *str)
> #if PY_MAJOR_VERSION < 3
> return PyString_FromString (str);
> #else
> - return PyUnicode_FromString (str);
> + return guestfs_int_py_fromstringsize (str, strlen (str));
> #endif
> }
>
> @@ -397,7 +397,12 @@ guestfs_int_py_fromstringsize (const char *str, size_t size)
> #if PY_M...
2020 Jun 30
0
Re: [PATCH v3] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...ll do it shortly.
BTW do you have a reproducer I can actually try freely?
> diff --git a/python/handle.c b/python/handle.c
> index 2fb8c18f0..fe89dc58a 100644
> --- a/python/handle.c
> +++ b/python/handle.c
> @@ -387,7 +387,7 @@ guestfs_int_py_fromstring (const char *str)
> #if PY_MAJOR_VERSION < 3
> return PyString_FromString (str);
> #else
> - return PyUnicode_FromString (str);
> + return guestfs_int_py_fromstringsize (str, strlen (str));
> #endif
> }
>
> @@ -397,7 +397,12 @@ guestfs_int_py_fromstringsize (const char *str, size_t size)
> #if PY_M...
2010 Oct 13
1
[PATCH]: pyxl: fix build of python xl binding for python < 2.5
...uild by way of a heinous preprocessor
macro.
diff -r 38ad3633ecaf tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c Wed Oct 13 12:01:30 2010 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c Wed Oct 13 17:51:44 2010 +0100
@@ -51,6 +51,10 @@
#define CLS "ctx"
+#if PY_MAJOR_VERSION < 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5)
+#define Py_ssize_t int
+#endif
+
static PyObject *xl_error_obj;
int genwrap__obj_init(PyObject *self, PyObject *args, PyObject *kwds)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.x...
2020 Jun 30
0
Re: [PATCH v3] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...> > >
> > > diff --git a/python/handle.c b/python/handle.c
> > > index 2fb8c18f0..fe89dc58a 100644
> > > --- a/python/handle.c
> > > +++ b/python/handle.c
> > > @@ -387,7 +387,7 @@ guestfs_int_py_fromstring (const char *str)
> > > #if PY_MAJOR_VERSION < 3
> > > return PyString_FromString (str);
> > > #else
> > > - return PyUnicode_FromString (str);
> > > + return guestfs_int_py_fromstringsize (str, strlen (str));
> > > #endif
> > > }
> > >
> > > @@ -397,7 +397,12...
2019 Jan 22
3
[PATCH v2 0/2] python: fixes for Python 3
A couple of fixes for Python 3 to the Python binding.
Unfortunately a behaviour change is needed, although it fixes broken
types used.
Changes from v1:
- handle also FBuffer in structs
Pino Toscano (2):
python: fix call of Python handlers of events
python: change types for RBufferOut/FBuffer with Python 3
(RHBZ#1661871)
generator/python.ml | 9 +++++++++
python/handle.c | 3 ++-
2
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
2019 Jan 22
3
[PATCH 0/2] python: fixes for Python 3
A couple of fixes for Python 3 to the Python binding.
Unfortunately a behaviour change is needed, although it fixes broken
types used.
Pino Toscano (2):
python: fix call of Python handlers of events
python: change return type for RBufferOut with Python 3 (RHBZ#1661871)
generator/python.ml | 4 ++++
python/handle.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
--
2.20.1
2020 Apr 25
1
Re: [PATCH v2] python: Fix UnicodeError in inspect_list_applications2() (RHBZ#1684004)
...ed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/python/handle.c b/python/handle.c
> > index 2fb8c18f0..427424707 100644
> > --- a/python/handle.c
> > +++ b/python/handle.c
> > @@ -387,7 +387,7 @@ guestfs_int_py_fromstring (const char *str)
> > #if PY_MAJOR_VERSION < 3
> > return PyString_FromString (str);
> > #else
> > - return PyUnicode_FromString (str);
> > + return PyUnicode_Decode(str, strlen(str), "utf-8", "replace");
> > #endif
> > }
> >
> > @@ -397,7 +397,7 @@ guestfs_int_p...
2018 Apr 11
0
[nbdkit PATCH v2 1/5] python: Let zero's may_trim parameter be optional
...NULL);
+
+#ifdef HAVE_PYSTRING_FROMSTRING
+ pname = PyString_FromString ("inspect");
+#else
+ pname = PyUnicode_FromString ("inspect");
+#endif
+ if (!pname)
+ return -1;
+ inspect = PyImport_Import (pname);
+ Py_DECREF (pname);
+
+ if (!inspect)
+ return -1;
+
+#if PY_MAJOR_VERSION >= 3
+ pname = PyUnicode_FromString ("getfullargspec");
+#else
+ pname = PyString_FromString ("getargspec");
+#endif
+ spec = PyObject_CallMethodObjArgs (inspect, pname, fn, NULL);
+ Py_DECREF (pname);
+ Py_DECREF (inspect);
+ if (!spec)
+ return -1;
+
+ /* We got t...
2018 Apr 06
1
[nbdkit PATCH] python: Let zero's may_trim parameter be optional
...t r = 0;
+ PyObject *inspect, *pname, *spec, *args;
+
+ assert (script != NULL);
+ assert (module != NULL);
+
+ pname = PyString_FromString ("inspect");
+ if (!pname)
+ return -1;
+ inspect = PyImport_Import (pname);
+ Py_DECREF (pname);
+
+ if (!inspect)
+ return -1;
+
+#if PY_MAJOR_VERSION >= 3
+ pname = PyString_FromString ("getfullargspec");
+#else
+ pname = PyString_FromString ("getargspec");
+#endif
+ spec = PyObject_CallMethodObjArgs (inspect, pname, fn, NULL);
+ Py_DECREF (pname);
+ Py_DECREF (inspect);
+ if (!spec)
+ return -1;
+
+ /* Yay, we g...
2019 Jan 22
0
[PATCH 2/2] python: change return type for RBufferOut with Python 3 (RHBZ#1661871)
...00644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -511,7 +511,11 @@ and generate_python_actions actions () =
pr " guestfs_int_free_string_list (r);\n";
pr " if (py_r == NULL) goto out;\n";
| RBufferOut _ ->
+ pr "#if PY_MAJOR_VERSION >= 3\n";
+ pr " py_r = PyBytes_FromStringAndSize (r, size);\n";
+ pr "#else\n";
pr " py_r = guestfs_int_py_fromstringsize (r, size);\n";
+ pr "#endif\n";
pr " free (r);\n";...