about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/lxml/libxml-2.12.patch
blob: d0d211c9fe38b1560e8f3c5e80f1439267028fe0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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