diff --git a/bypy/sources.json b/bypy/sources.json index ee284f57e3..c8b10346a0 100644 --- a/bypy/sources.json +++ b/bypy/sources.json @@ -321,17 +321,17 @@ { "name": "libxml2", "unix": { - "filename": "libxml2-2.11.5.tar.xz", - "hash": "sha256:3727b078c360ec69fa869de14bd6f75d7ee8d36987b071e6928d4720a28df3a6", - "urls": ["https://download.gnome.org/sources/libxml2/2.11/{filename}"] + "filename": "libxml2-2.12.1.tar.xz", + "hash": "sha256:8982b9ccdf7f456e30d8f7012d50858c6623e495333b6191def455c7e95427eb", + "urls": ["https://download.gnome.org/sources/libxml2/2.12/{filename}"] } }, { "name": "libxslt", "unix": { - "filename": "libxslt-1.1.38.tar.xz", - "hash": "sha256:1f32450425819a09acaff2ab7a5a7f8a2ec7956e505d7beeb45e843d0e1ecab1", + "filename": "libxslt-1.1.39.tar.xz", + "hash": "sha256:2a20ad621148339b0759c4d4e96719362dee64c9a096dbba625ba053846349f0", "urls": ["https://download.gnome.org/sources/libxslt/1.1/{filename}"] } }, diff --git a/bypy/windows/site.py b/bypy/windows/site.py index 146027bcdf..1563c330f2 100644 --- a/bypy/windows/site.py +++ b/bypy/windows/site.py @@ -60,6 +60,16 @@ def set_quit(): builtins.exit = _sitebuiltins.Quitter('exit', eof) +def workaround_lxml_bug(): + # Without calling xmlInitParser() import lxml causes a segfault + import ctypes + x = ctypes.WinDLL('libxml2.dll') + x.xmlInitParser() + workaround_lxml_bug.libxml2 = x + from lxml import etree + del etree + + def main(): sys.meta_path.insert(0, PydImporter()) os.add_dll_directory(os.path.abspath(os.path.join(sys.app_dir, 'app', 'bin'))) @@ -75,6 +85,8 @@ def main(): set_helper() set_quit() + workaround_lxml_bug() + return run_entry_point() diff --git a/src/calibre/ebooks/oeb/polish/check/parsing.py b/src/calibre/ebooks/oeb/polish/check/parsing.py index 022369c568..b955f9c222 100644 --- a/src/calibre/ebooks/oeb/polish/check/parsing.py +++ b/src/calibre/ebooks/oeb/polish/check/parsing.py @@ -292,7 +292,7 @@ def check_xml_parsing(name, mt, raw): except XMLSyntaxError as err: try: line, col = err.position - except: + except Exception: line = col = None return errors + [errcls(error_message(err), name, line, col)] except Exception as err: