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
|
Obtained from: https://github.com/lxml/lxml/commit/6a0f0f09e26d574e75848d0ca1ef00e97ee49658
https://github.com/lxml/lxml/commit/99c81a6694f92dd09626f861f313505ab667b948
--- setupinfo.py.orig 2025-04-22 12:23:54 UTC
+++ setupinfo.py
@@ -176,34 +176,6 @@ def ext_modules(static_include_dirs, static_library_di
from Cython.Build import cythonize
result = cythonize(result, compiler_directives=cythonize_directives)
- # Fix compiler warning due to missing pragma-push in Cython 3.0.9.
- for ext in result:
- for source_file in ext.sources:
- if not source_file.endswith('.c'):
- continue
- with open(source_file, 'rb') as f:
- lines = f.readlines()
- if b'Generated by Cython 3.0.9' not in lines[0]:
- continue
-
- modified = False
- temp_file = source_file + ".tmp"
- with open(temp_file, 'wb') as f:
- last_was_push = False
- for line in lines:
- if b'#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"' in line and not last_was_push:
- f.write(b"#pragma GCC diagnostic push\n")
- modified = True
- last_was_push = b'#pragma GCC diagnostic push' in line
- f.write(line)
-
- if modified:
- print("Fixed Cython 3.0.9 generated source file " + source_file)
- os.unlink(source_file)
- os.rename(temp_file, source_file)
- else:
- os.unlink(temp_file)
-
# for backwards compatibility reasons, provide "etree[_api].h" also as "lxml.etree[_api].h"
for header_filename in HEADER_FILES:
src_file = os.path.join(SOURCE_PATH, 'lxml', header_filename)
@@ -367,6 +339,8 @@ def define_macros():
macros.append(('LXML_UNICODE_STRINGS', '1'))
if OPTION_WITH_COVERAGE:
macros.append(('CYTHON_TRACE_NOGIL', '1'))
+ # coverage.py does not support Cython together with sys.monitoring.
+ macros.append(('CYTHON_USE_SYS_MONITORING', '0'))
if OPTION_BUILD_LIBXML2XSLT:
macros.append(('LIBXML_STATIC', None))
macros.append(('LIBXSLT_STATIC', None))
|