diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2020-10-28 22:05:57 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-10-30 13:22:49 +0000 |
commit | bb5bfc3ac7a991f608036d2db1369a06dd24a0fa (patch) | |
tree | 6437203cd0646d3601b40f6e1b833d1c585d0071 /meta | |
parent | 6c9e07e6507c8520176a694d7330653d43b1ba13 (diff) | |
download | poky-bb5bfc3ac7a991f608036d2db1369a06dd24a0fa.tar.gz |
libxml2: add a patch to fix python 3.9 support
(From OE-Core rev: 0d0acc5fefc96ee0f0a856f7fa34caf92e03138f)
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-core/libxml/libxml2/fix-python39.patch | 94 | ||||
-rw-r--r-- | meta/recipes-core/libxml/libxml2_2.9.10.bb | 1 |
2 files changed, 95 insertions, 0 deletions
diff --git a/meta/recipes-core/libxml/libxml2/fix-python39.patch b/meta/recipes-core/libxml/libxml2/fix-python39.patch new file mode 100644 index 0000000000..32590f9ddf --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/fix-python39.patch | |||
@@ -0,0 +1,94 @@ | |||
1 | From e4fb36841800038c289997432ca547c9bfef9db1 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz> | ||
3 | Date: Fri, 28 Feb 2020 12:48:14 +0100 | ||
4 | Subject: [PATCH] Parenthesize Py<type>_Check() in ifs | ||
5 | |||
6 | In C, if expressions should be parenthesized. | ||
7 | PyLong_Check, PyUnicode_Check etc. happened to expand to a parenthesized | ||
8 | expression before, but that's not API to rely on. | ||
9 | |||
10 | Since Python 3.9.0a4 it needs to be parenthesized explicitly. | ||
11 | |||
12 | Fixes https://gitlab.gnome.org/GNOME/libxml2/issues/149 | ||
13 | Upstream-Status: Backport | ||
14 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
15 | --- | ||
16 | python/libxml.c | 4 ++-- | ||
17 | python/types.c | 12 ++++++------ | ||
18 | 2 files changed, 8 insertions(+), 8 deletions(-) | ||
19 | |||
20 | diff --git a/python/libxml.c b/python/libxml.c | ||
21 | index bc676c4e0..81e709f34 100644 | ||
22 | --- a/python/libxml.c | ||
23 | +++ b/python/libxml.c | ||
24 | @@ -294,7 +294,7 @@ xmlPythonFileReadRaw (void * context, char * buffer, int len) { | ||
25 | lenread = PyBytes_Size(ret); | ||
26 | data = PyBytes_AsString(ret); | ||
27 | #ifdef PyUnicode_Check | ||
28 | - } else if PyUnicode_Check (ret) { | ||
29 | + } else if (PyUnicode_Check (ret)) { | ||
30 | #if PY_VERSION_HEX >= 0x03030000 | ||
31 | Py_ssize_t size; | ||
32 | const char *tmp; | ||
33 | @@ -359,7 +359,7 @@ xmlPythonFileRead (void * context, char * buffer, int len) { | ||
34 | lenread = PyBytes_Size(ret); | ||
35 | data = PyBytes_AsString(ret); | ||
36 | #ifdef PyUnicode_Check | ||
37 | - } else if PyUnicode_Check (ret) { | ||
38 | + } else if (PyUnicode_Check (ret)) { | ||
39 | #if PY_VERSION_HEX >= 0x03030000 | ||
40 | Py_ssize_t size; | ||
41 | const char *tmp; | ||
42 | diff --git a/python/types.c b/python/types.c | ||
43 | index c2bafeb19..ed284ec74 100644 | ||
44 | --- a/python/types.c | ||
45 | +++ b/python/types.c | ||
46 | @@ -602,16 +602,16 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj) | ||
47 | if (obj == NULL) { | ||
48 | return (NULL); | ||
49 | } | ||
50 | - if PyFloat_Check (obj) { | ||
51 | + if (PyFloat_Check (obj)) { | ||
52 | ret = xmlXPathNewFloat((double) PyFloat_AS_DOUBLE(obj)); | ||
53 | - } else if PyLong_Check(obj) { | ||
54 | + } else if (PyLong_Check(obj)) { | ||
55 | #ifdef PyLong_AS_LONG | ||
56 | ret = xmlXPathNewFloat((double) PyLong_AS_LONG(obj)); | ||
57 | #else | ||
58 | ret = xmlXPathNewFloat((double) PyInt_AS_LONG(obj)); | ||
59 | #endif | ||
60 | #ifdef PyBool_Check | ||
61 | - } else if PyBool_Check (obj) { | ||
62 | + } else if (PyBool_Check (obj)) { | ||
63 | |||
64 | if (obj == Py_True) { | ||
65 | ret = xmlXPathNewBoolean(1); | ||
66 | @@ -620,14 +620,14 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj) | ||
67 | ret = xmlXPathNewBoolean(0); | ||
68 | } | ||
69 | #endif | ||
70 | - } else if PyBytes_Check (obj) { | ||
71 | + } else if (PyBytes_Check (obj)) { | ||
72 | xmlChar *str; | ||
73 | |||
74 | str = xmlStrndup((const xmlChar *) PyBytes_AS_STRING(obj), | ||
75 | PyBytes_GET_SIZE(obj)); | ||
76 | ret = xmlXPathWrapString(str); | ||
77 | #ifdef PyUnicode_Check | ||
78 | - } else if PyUnicode_Check (obj) { | ||
79 | + } else if (PyUnicode_Check (obj)) { | ||
80 | #if PY_VERSION_HEX >= 0x03030000 | ||
81 | xmlChar *str; | ||
82 | const char *tmp; | ||
83 | @@ -650,7 +650,7 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj) | ||
84 | ret = xmlXPathWrapString(str); | ||
85 | #endif | ||
86 | #endif | ||
87 | - } else if PyList_Check (obj) { | ||
88 | + } else if (PyList_Check (obj)) { | ||
89 | int i; | ||
90 | PyObject *node; | ||
91 | xmlNodePtr cur; | ||
92 | -- | ||
93 | GitLab | ||
94 | |||
diff --git a/meta/recipes-core/libxml/libxml2_2.9.10.bb b/meta/recipes-core/libxml/libxml2_2.9.10.bb index 90890ffaed..07ae68610c 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 \ | |||
23 | file://CVE-2020-7595.patch \ | 23 | file://CVE-2020-7595.patch \ |
24 | file://CVE-2019-20388.patch \ | 24 | file://CVE-2019-20388.patch \ |
25 | file://CVE-2020-24977.patch \ | 25 | file://CVE-2020-24977.patch \ |
26 | file://fix-python39.patch \ | ||
26 | " | 27 | " |
27 | 28 | ||
28 | SRC_URI[libtar.md5sum] = "10942a1dc23137a8aa07f0639cbfece5" | 29 | SRC_URI[libtar.md5sum] = "10942a1dc23137a8aa07f0639cbfece5" |