1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2026-10-24 01:09:01 +03:00

python: Fix generator.py with python3 unicode

This commit is contained in:
Daniel Garcia Moreno
2026-03-30 13:02:38 +02:00
committed by Daniel Garcia Moreno
parent cd13f06758
commit cf5da89233

View File

@@ -415,14 +415,19 @@ for file in os.listdir(xmlDocDir):
docs = extractDocs(func.find('detaileddescription'))
# python 2.7 compat, https://gitlab.gnome.org/GNOME/libxml2/-/issues/1092
encoding = 'unicode'
if sys.version_info[0] == 2:
encoding = 'utf-8'
rtype = etree.tostring(func.find('type'),
method='text', encoding='utf-8').rstrip()
method='text', encoding=encoding).rstrip()
valid = True
args = []
for arg in func.findall('param'):
atype = etree.tostring(arg.find('type'),
method='text', encoding='utf-8').rstrip()
method='text', encoding=encoding).rstrip()
if atype == 'void':
continue