1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
4 # T2 SDE: package/*/libxml/python3.9.patch
5 # Copyright (C) 2021 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
17 diff -ur a/python/libxml.c b/python/libxml.c
18 --- a/python/libxml.c 2019-10-22 20:46:01.000000000 +0200
19 +++ b/python/libxml.c 2021-02-24 13:05:04.578363685 +0100
21 lenread = PyBytes_Size(ret);
22 data = PyBytes_AsString(ret);
23 #ifdef PyUnicode_Check
24 - } else if PyUnicode_Check (ret) {
25 + } else if (PyUnicode_Check (ret)) {
26 #if PY_VERSION_HEX >= 0x03030000
30 lenread = PyBytes_Size(ret);
31 data = PyBytes_AsString(ret);
32 #ifdef PyUnicode_Check
33 - } else if PyUnicode_Check (ret) {
34 + } else if (PyUnicode_Check (ret)) {
35 #if PY_VERSION_HEX >= 0x03030000
38 diff -ur a/python/types.c b/python/types.c
39 --- a/python/types.c 2019-10-22 20:46:01.000000000 +0200
40 +++ b/python/types.c 2021-02-24 13:05:04.578363685 +0100
45 - if PyFloat_Check (obj) {
46 + if (PyFloat_Check (obj)) {
47 ret = xmlXPathNewFloat((double) PyFloat_AS_DOUBLE(obj));
48 - } else if PyLong_Check(obj) {
49 + } else if (PyLong_Check(obj)) {
51 ret = xmlXPathNewFloat((double) PyLong_AS_LONG(obj));
53 ret = xmlXPathNewFloat((double) PyInt_AS_LONG(obj));
56 - } else if PyBool_Check (obj) {
57 + } else if (PyBool_Check (obj)) {
60 ret = xmlXPathNewBoolean(1);
62 ret = xmlXPathNewBoolean(0);
65 - } else if PyBytes_Check (obj) {
66 + } else if (PyBytes_Check (obj)) {
69 str = xmlStrndup((const xmlChar *) PyBytes_AS_STRING(obj),
70 PyBytes_GET_SIZE(obj));
71 ret = xmlXPathWrapString(str);
72 #ifdef PyUnicode_Check
73 - } else if PyUnicode_Check (obj) {
74 + } else if (PyUnicode_Check (obj)) {
75 #if PY_VERSION_HEX >= 0x03030000
79 ret = xmlXPathWrapString(str);
82 - } else if PyList_Check (obj) {
83 + } else if (PyList_Check (obj)) {