mcst-linux-kernel/patches-2024.06.26/python3-libxml2-2.9.7/0005-python3.9-compat-bug14...

76 lines
2.5 KiB
Diff

Link: https://github.com/GNOME/libxml2/commit/e4fb36841800038c289997432ca547c9bfef9db1
Subject: Parenthesize Py<type>_Check() in ifs
Bug: 149659
Tags: common
diff -rupN a/python/libxml.c b/python/libxml.c
--- a/python/libxml.c 2023-05-23 22:21:42.882880114 +0300
+++ b/python/libxml.c 2023-05-23 22:28:20.106169145 +0300
@@ -294,7 +294,7 @@ xmlPythonFileReadRaw (void * context, ch
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
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 -rupN a/python/types.c b/python/types.c
--- a/python/types.c 2023-05-23 22:21:48.641478672 +0300
+++ b/python/types.c 2023-05-23 22:30:31.944061805 +0300
@@ -604,16 +604,16 @@ libxml_xmlXPathObjectPtrConvert(PyObject
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);
@@ -622,14 +622,14 @@ libxml_xmlXPathObjectPtrConvert(PyObject
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;
@@ -652,7 +652,7 @@ libxml_xmlXPathObjectPtrConvert(PyObject
ret = xmlXPathWrapString(str);
#endif
#endif
- } else if PyList_Check (obj) {
+ } else if (PyList_Check (obj)) {
int i;
PyObject *node;
xmlNodePtr cur;