Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 745162
Collapse All | Expand All

(-)libxml2-2.9.5/python/libxml.c (-1 / +10 lines)
Lines 1620-1625 libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU Link Here
1620
    PyObject *message;
1620
    PyObject *message;
1621
    PyObject *result;
1621
    PyObject *result;
1622
    char str[1000];
1622
    char str[1000];
1623
    unsigned char *ptr = (unsigned char *)str;
1623
1624
1624
#ifdef DEBUG_ERROR
1625
#ifdef DEBUG_ERROR
1625
    printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
1626
    printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
Lines 1636-1647 libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU Link Here
1636
	    str[999] = 0;
1637
	    str[999] = 0;
1637
        va_end(ap);
1638
        va_end(ap);
1638
1639
1640
#if PY_MAJOR_VERSION >= 3
1641
        /* Ensure the error string doesn't start at UTF8 continuation. */
1642
        while (*ptr && (*ptr & 0xc0) == 0x80)
1643
            ptr++;
1644
#endif
1645
1639
        list = PyTuple_New(2);
1646
        list = PyTuple_New(2);
1640
        PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
1647
        PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
1641
        Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
1648
        Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
1642
        message = libxml_charPtrConstWrap(str);
1649
        message = libxml_charPtrConstWrap(ptr);
1643
        PyTuple_SetItem(list, 1, message);
1650
        PyTuple_SetItem(list, 1, message);
1644
        result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
1651
        result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
1652
        /* Forget any errors caused in the error handler. */
1653
        PyErr_Clear();
1645
        Py_XDECREF(list);
1654
        Py_XDECREF(list);
1646
        Py_XDECREF(result);
1655
        Py_XDECREF(result);
1647
    }
1656
    }

Return to bug 745162