about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/lxml/libxml-2.12.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/lxml/libxml-2.12.patch')
-rw-r--r--nixpkgs/pkgs/development/python-modules/lxml/libxml-2.12.patch94
1 files changed, 94 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/lxml/libxml-2.12.patch b/nixpkgs/pkgs/development/python-modules/lxml/libxml-2.12.patch
new file mode 100644
index 000000000000..d0d211c9fe38
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/lxml/libxml-2.12.patch
@@ -0,0 +1,94 @@
+From 3b8807306d79d2ae2e9fa28c5ecd3b40b32ee65b Mon Sep 17 00:00:00 2001
+From: Stefan Behnel <stefan_ml@behnel.de>
+Date: Wed, 29 Nov 2023 10:28:47 +0100
+Subject: [PATCH] Follow changes in libxml2 2.12 and make xmlError usages
+ 'const'. This mostly impacts the error callback functions.
+
+---
+ src/lxml/extensions.pxi | 4 ++--
+ src/lxml/parser.pxi     | 4 ++--
+ src/lxml/xmlerror.pxi   | 8 ++++----
+ 3 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/src/lxml/extensions.pxi b/src/lxml/extensions.pxi
+index 35a321b7..42b4c4f6 100644
+--- a/src/lxml/extensions.pxi
++++ b/src/lxml/extensions.pxi
+@@ -393,7 +393,7 @@ cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = (
+     b"?? Unknown error ??\n",
+ )
+ 
+-cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil:
++cdef void _forwardXPathError(void* c_ctxt, const xmlerror.xmlError* c_error) with gil:
+     cdef xmlerror.xmlError error
+     cdef int xpath_code
+     if c_error.message is not NULL:
+@@ -414,7 +414,7 @@ cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil:
+ 
+     (<_BaseContext>c_ctxt)._error_log._receive(&error)
+ 
+-cdef void _receiveXPathError(void* c_context, xmlerror.xmlError* error) nogil:
++cdef void _receiveXPathError(void* c_context, const xmlerror.xmlError* error) nogil:
+     if not __DEBUG:
+         return
+     if c_context is NULL:
+diff --git a/src/lxml/parser.pxi b/src/lxml/parser.pxi
+index 22463c7d..1566b6df 100644
+--- a/src/lxml/parser.pxi
++++ b/src/lxml/parser.pxi
+@@ -626,10 +626,10 @@ cdef _initParserContext(_ParserContext context,
+     if c_ctxt is not NULL:
+         context._initParserContext(c_ctxt)
+ 
+-cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) with gil:
++cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, const xmlerror.xmlError* error) with gil:
+     (<_ParserContext>_parser_context._private)._error_log._receive(error)
+ 
+-cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) nogil:
++cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) nogil:
+     if __DEBUG:
+         if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:
+             _forwardError(NULL, error)
+diff --git a/src/lxml/xmlerror.pxi b/src/lxml/xmlerror.pxi
+index 1b50444f..4cd745f9 100644
+--- a/src/lxml/xmlerror.pxi
++++ b/src/lxml/xmlerror.pxi
+@@ -66,7 +66,7 @@ cdef class _LogEntry:
+         tree.xmlFree(self._c_path)
+ 
+     @cython.final
+-    cdef _setError(self, xmlerror.xmlError* error):
++    cdef _setError(self, const xmlerror.xmlError* error):
+         self.domain   = error.domain
+         self.type     = error.code
+         self.level    = <int>error.level
+@@ -198,7 +198,7 @@ cdef class _BaseErrorLog:
+         pass
+ 
+     @cython.final
+-    cdef void _receive(self, xmlerror.xmlError* error):
++    cdef void _receive(self, const xmlerror.xmlError* error):
+         cdef bint is_error
+         cdef _LogEntry entry
+         cdef _BaseErrorLog global_log
+@@ -634,7 +634,7 @@ def use_global_python_log(PyErrorLog log not None):
+ 
+ 
+ # local log functions: forward error to logger object
+-cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil:
++cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) with gil:
+     cdef _BaseErrorLog log_handler
+     if c_log_handler is not NULL:
+         log_handler = <_BaseErrorLog>c_log_handler
+@@ -645,7 +645,7 @@ cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil:
+     log_handler._receive(error)
+ 
+ 
+-cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) nogil:
++cdef void _receiveError(void* c_log_handler, const xmlerror.xmlError* error) nogil:
+     # no Python objects here, may be called without thread context !
+     if __DEBUG:
+         _forwardError(c_log_handler, error)
+-- 
+2.42.0
+