Files
libxml2/libxml2-python3-unicode-errors.patch
Petr Gajdos 433d883e3a Accepting request 1302350 from home:pgajdos:libxml2
- version update to 2.14.5
  2.14.0
  ** Major changes **
  o The HTML tokenizer now conforms fully to HTML5.
  o Binary compatibility is restricted to versions 2.14 or newer.
    The soname was bumped from libxml2.so.2 to libxml2.so.16.
  o The serialization API will now take user-provided or default
    encodings into account when serializing attribute values.
  o The XML parser won't try to merge consecutive CDATA sections
    as before to align with web standards.
  o Support for RELAX NG can now be disabled with a new configuration
    option independently of XML Schemas support.
  o The "legacy" configuration option won't enable support for HTTP
    and LZMA anymore. 
  o Parts of the xmllint executable were refactored, allowing the
    combination of more options.
  o Meson is fully supported now.
  o Parts of the buffering code were reworked and simplified.
  o Overflow checks before reallocations were hardenend.
  o Some unprefixed symbols were renamed to avoid namespace pollution.
  ** New features **
  o Input callbacks can now be set on a parser context and an improved
    API to create parser input is available.
  o The following new functions, taking a parser input object, were added:
    . xmlCtxtParseDocument
    . xmlCtxtParseContent
    . xmlCtxtParseDtd
  o The xmlSave API now has additional options to replace global settings.
  o Parser options XML_PARSE_UNZIP, XML_PARSE_NO_SYS_CATALOG and
    XML_PARSE_CATALOG_PI were added.

OBS-URL: https://build.opensuse.org/request/show/1302350
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libxml2?expand=0&rev=252
2025-09-09 08:15:17 +00:00

39 lines
1.3 KiB
Diff

---
python/libxml.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
Index: libxml2-2.14.5/python/libxml.c
===================================================================
--- libxml2-2.14.5.orig/python/libxml.c
+++ libxml2-2.14.5/python/libxml.c
@@ -1499,6 +1499,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
PyObject *message;
PyObject *result;
char str[1000];
+ unsigned char *ptr = (unsigned char *)str;
if (libxml_xmlPythonErrorFuncHandler == NULL) {
va_start(ap, msg);
@@ -1510,12 +1511,20 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
str[999] = 0;
va_end(ap);
+#if PY_MAJOR_VERSION >= 3
+ /* Ensure the error string doesn't start at UTF8 continuation. */
+ while (*ptr && (*ptr & 0xc0) == 0x80)
+ ptr++;
+#endif
+
list = PyTuple_New(2);
PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
- message = libxml_charPtrConstWrap(str);
+ message = libxml_charPtrConstWrap(ptr);
PyTuple_SetItem(list, 1, message);
result = PyObject_CallObject(libxml_xmlPythonErrorFuncHandler, list);
+ /* Forget any errors caused in the error handler. */
+ PyErr_Clear();
Py_XDECREF(list);
Py_XDECREF(result);
}