All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libxml2: Backport patch to fix Python3.9 syntax
@ 2020-10-24 21:20 Alejandro Hernandez Samaniego
  2020-10-24 21:20 ` [PATCH 2/2] python3: upgrade to python 3.9.0 Alejandro Hernandez Samaniego
  0 siblings, 1 reply; 6+ messages in thread
From: Alejandro Hernandez Samaniego @ 2020-10-24 21:20 UTC (permalink / raw)
  To: openembedded-core; +Cc: Alejandro Enedino Hernandez Samaniego

Building against python 3.9 causes some errors while compiling,
this has been fixed upstream, but hasnt been released yet:

upstream tracker:
https://gitlab.gnome.org/GNOME/libxml2/-/issues/149

Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro.hernandez@linux.microsoft.com>
---
 ...1-Parenthesize-Py-type-_Check-in-ifs.patch | 96 +++++++++++++++++++
 meta/recipes-core/libxml/libxml2_2.9.10.bb    |  1 +
 2 files changed, 97 insertions(+)
 create mode 100644 meta/recipes-core/libxml/libxml2/0001-Parenthesize-Py-type-_Check-in-ifs.patch

diff --git a/meta/recipes-core/libxml/libxml2/0001-Parenthesize-Py-type-_Check-in-ifs.patch b/meta/recipes-core/libxml/libxml2/0001-Parenthesize-Py-type-_Check-in-ifs.patch
new file mode 100644
index 0000000000..bee8ab2cf6
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/0001-Parenthesize-Py-type-_Check-in-ifs.patch
@@ -0,0 +1,96 @@
+From e4fb36841800038c289997432ca547c9bfef9db1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Fri, 28 Feb 2020 12:48:14 +0100
+Subject: [PATCH] Parenthesize Py<type>_Check() in ifs
+
+In C, if expressions should be parenthesized.
+PyLong_Check, PyUnicode_Check etc. happened to expand to a parenthesized
+expression before, but that's not API to rely on.
+
+Since Python 3.9.0a4 it needs to be parenthesized explicitly.
+
+Fixes https://gitlab.gnome.org/GNOME/libxml2/issues/149
+
+Upstream-Status: Backport
+Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro.hernandez@linux.microsoft.com>
+
+---
+ python/libxml.c |  4 ++--
+ python/types.c  | 12 ++++++------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/python/libxml.c b/python/libxml.c
+index bc676c4e..81e709f3 100644
+--- a/python/libxml.c
++++ b/python/libxml.c
+@@ -294,7 +294,7 @@ xmlPythonFileReadRaw (void * context, char * buffer, int len) {
+ 	lenread = PyBytes_Size(ret);
+ 	data = PyBytes_AsString(ret);
+ #ifdef PyUnicode_Check
+-    } else if PyUnicode_Check (ret) {
++    } else if (PyUnicode_Check (ret)) {
+ #if PY_VERSION_HEX >= 0x03030000
+         Py_ssize_t size;
+ 	const char *tmp;
+@@ -359,7 +359,7 @@ xmlPythonFileRead (void * context, char * buffer, int len) {
+ 	lenread = PyBytes_Size(ret);
+ 	data = PyBytes_AsString(ret);
+ #ifdef PyUnicode_Check
+-    } else if PyUnicode_Check (ret) {
++    } else if (PyUnicode_Check (ret)) {
+ #if PY_VERSION_HEX >= 0x03030000
+         Py_ssize_t size;
+ 	const char *tmp;
+diff --git a/python/types.c b/python/types.c
+index c2bafeb1..ed284ec7 100644
+--- a/python/types.c
++++ b/python/types.c
+@@ -602,16 +602,16 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj)
+     if (obj == NULL) {
+         return (NULL);
+     }
+-    if PyFloat_Check (obj) {
++    if (PyFloat_Check (obj)) {
+         ret = xmlXPathNewFloat((double) PyFloat_AS_DOUBLE(obj));
+-    } else if PyLong_Check(obj) {
++    } else if (PyLong_Check(obj)) {
+ #ifdef PyLong_AS_LONG
+         ret = xmlXPathNewFloat((double) PyLong_AS_LONG(obj));
+ #else
+         ret = xmlXPathNewFloat((double) PyInt_AS_LONG(obj));
+ #endif
+ #ifdef PyBool_Check
+-    } else if PyBool_Check (obj) {
++    } else if (PyBool_Check (obj)) {
+ 
+         if (obj == Py_True) {
+           ret = xmlXPathNewBoolean(1);
+@@ -620,14 +620,14 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj)
+           ret = xmlXPathNewBoolean(0);
+         }
+ #endif
+-    } else if PyBytes_Check (obj) {
++    } else if (PyBytes_Check (obj)) {
+         xmlChar *str;
+ 
+         str = xmlStrndup((const xmlChar *) PyBytes_AS_STRING(obj),
+                          PyBytes_GET_SIZE(obj));
+         ret = xmlXPathWrapString(str);
+ #ifdef PyUnicode_Check
+-    } else if PyUnicode_Check (obj) {
++    } else if (PyUnicode_Check (obj)) {
+ #if PY_VERSION_HEX >= 0x03030000
+         xmlChar *str;
+ 	const char *tmp;
+@@ -650,7 +650,7 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj)
+ 	ret = xmlXPathWrapString(str);
+ #endif
+ #endif
+-    } else if PyList_Check (obj) {
++    } else if (PyList_Check (obj)) {
+         int i;
+         PyObject *node;
+         xmlNodePtr cur;
+-- 
+2.25.1
+
diff --git a/meta/recipes-core/libxml/libxml2_2.9.10.bb b/meta/recipes-core/libxml/libxml2_2.9.10.bb
index 90890ffaed..2034eaf36e 100644
--- a/meta/recipes-core/libxml/libxml2_2.9.10.bb
+++ b/meta/recipes-core/libxml/libxml2_2.9.10.bb
@@ -23,6 +23,7 @@ SRC_URI = "http://www.xmlsoft.org/sources/libxml2-${PV}.tar.gz;name=libtar \
            file://CVE-2020-7595.patch \
            file://CVE-2019-20388.patch \
            file://CVE-2020-24977.patch \
+           file://0001-Parenthesize-Py-type-_Check-in-ifs.patch \
            "
 
 SRC_URI[libtar.md5sum] = "10942a1dc23137a8aa07f0639cbfece5"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-20  9:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-24 21:20 [PATCH 1/2] libxml2: Backport patch to fix Python3.9 syntax Alejandro Hernandez Samaniego
2020-10-24 21:20 ` [PATCH 2/2] python3: upgrade to python 3.9.0 Alejandro Hernandez Samaniego
2020-10-24 21:35   ` [OE-core] " Alexander Kanavin
2020-10-24 21:59     ` Alejandro Hernandez Samaniego
2020-10-25  7:05       ` Alexander Kanavin
2021-03-20  9:57     ` Martin Jansa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.