Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Fri, 03 Sep 2021 22:25:00 UTC
Commit: 6d9e24e78d053758f3db682ff1af3231159608f6
https://github.com/geany/geany/commit/6d9e24e78d053758f3db682ff1af323115960…
Log Message:
-----------
Use "encoding" keyword argument for lxml's tostring()
Newer versions of libxml2 (used by lxml) crash in tostring() when no
encoding argument is present. Passing "unicode" as encoding makes
tostring() returning already a Python unicode string, so we don't
need to decode it anymore.
Modified Paths:
--------------
scripts/gen-api-gtkdoc.py
Modified: scripts/gen-api-gtkdoc.py
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -106,7 +106,7 @@ def stringify_children(node):
from lxml.etree import tostring
from itertools import chain
parts = ([node.text] +
- list(chain(*([c.text, tostring(c).decode("utf-8"), c.tail] for c in node.getchildren()))) +
+ list(chain(*([c.text, tostring(c, encoding='unicode'), c.tail] for c in node.getchildren()))) +
[node.tail])
# filter removes possible Nones in texts and tails
return "".join(filter(None, parts))
@@ -121,9 +121,9 @@ def get_program_listing(self, xml):
# <sp/> tags must be replaced with spaces, then just use the text
h = l.find("highlight")
if h is not None:
- html = tostring(h).decode("utf-8")
+ html = tostring(h, encoding='unicode')
html = html.replace("<sp/>", " ")
- arr.append(" " + tostring(etree.HTML(html), method="text").decode("utf-8"))
+ arr.append(" " + tostring(etree.HTML(html), method="text", encoding='unicode'))
arr.append("]|")
return "\n".join(arr)
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).