at 24.11-pre 3.9 kB view raw
1From 3b8807306d79d2ae2e9fa28c5ecd3b40b32ee65b Mon Sep 17 00:00:00 2001 2From: Stefan Behnel <stefan_ml@behnel.de> 3Date: Wed, 29 Nov 2023 10:28:47 +0100 4Subject: [PATCH] Follow changes in libxml2 2.12 and make xmlError usages 5 'const'. This mostly impacts the error callback functions. 6 7--- 8 src/lxml/extensions.pxi | 4 ++-- 9 src/lxml/parser.pxi | 4 ++-- 10 src/lxml/xmlerror.pxi | 8 ++++---- 11 3 files changed, 8 insertions(+), 8 deletions(-) 12 13diff --git a/src/lxml/extensions.pxi b/src/lxml/extensions.pxi 14index 35a321b7..42b4c4f6 100644 15--- a/src/lxml/extensions.pxi 16+++ b/src/lxml/extensions.pxi 17@@ -393,7 +393,7 @@ cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = ( 18 b"?? Unknown error ??\n", 19 ) 20 21-cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil: 22+cdef void _forwardXPathError(void* c_ctxt, const xmlerror.xmlError* c_error) with gil: 23 cdef xmlerror.xmlError error 24 cdef int xpath_code 25 if c_error.message is not NULL: 26@@ -414,7 +414,7 @@ cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil: 27 28 (<_BaseContext>c_ctxt)._error_log._receive(&error) 29 30-cdef void _receiveXPathError(void* c_context, xmlerror.xmlError* error) nogil: 31+cdef void _receiveXPathError(void* c_context, const xmlerror.xmlError* error) nogil: 32 if not __DEBUG: 33 return 34 if c_context is NULL: 35diff --git a/src/lxml/parser.pxi b/src/lxml/parser.pxi 36index 22463c7d..1566b6df 100644 37--- a/src/lxml/parser.pxi 38+++ b/src/lxml/parser.pxi 39@@ -626,10 +626,10 @@ cdef _initParserContext(_ParserContext context, 40 if c_ctxt is not NULL: 41 context._initParserContext(c_ctxt) 42 43-cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) with gil: 44+cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, const xmlerror.xmlError* error) with gil: 45 (<_ParserContext>_parser_context._private)._error_log._receive(error) 46 47-cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) nogil: 48+cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) nogil: 49 if __DEBUG: 50 if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL: 51 _forwardError(NULL, error) 52diff --git a/src/lxml/xmlerror.pxi b/src/lxml/xmlerror.pxi 53index 1b50444f..4cd745f9 100644 54--- a/src/lxml/xmlerror.pxi 55+++ b/src/lxml/xmlerror.pxi 56@@ -66,7 +66,7 @@ cdef class _LogEntry: 57 tree.xmlFree(self._c_path) 58 59 @cython.final 60- cdef _setError(self, xmlerror.xmlError* error): 61+ cdef _setError(self, const xmlerror.xmlError* error): 62 self.domain = error.domain 63 self.type = error.code 64 self.level = <int>error.level 65@@ -198,7 +198,7 @@ cdef class _BaseErrorLog: 66 pass 67 68 @cython.final 69- cdef void _receive(self, xmlerror.xmlError* error): 70+ cdef void _receive(self, const xmlerror.xmlError* error): 71 cdef bint is_error 72 cdef _LogEntry entry 73 cdef _BaseErrorLog global_log 74@@ -634,7 +634,7 @@ def use_global_python_log(PyErrorLog log not None): 75 76 77 # local log functions: forward error to logger object 78-cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil: 79+cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) with gil: 80 cdef _BaseErrorLog log_handler 81 if c_log_handler is not NULL: 82 log_handler = <_BaseErrorLog>c_log_handler 83@@ -645,7 +645,7 @@ cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil: 84 log_handler._receive(error) 85 86 87-cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) nogil: 88+cdef void _receiveError(void* c_log_handler, const xmlerror.xmlError* error) nogil: 89 # no Python objects here, may be called without thread context ! 90 if __DEBUG: 91 _forwardError(c_log_handler, error) 92-- 932.42.0 94