mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #2048475 [Tests fail with lxml 5.0](https://bugs.launchpad.net/calibre/+bug/2048475)
This commit is contained in:
parent
140ea63f8c
commit
e9cc00560a
@ -36,6 +36,11 @@ def safe_xml_fromstring(string_or_bytes, recover=True):
|
||||
return ans
|
||||
|
||||
|
||||
def unsafe_xml_fromstring(string_or_bytes):
|
||||
parser = etree.XMLParser(resolve_entities=True)
|
||||
return fs(string_or_bytes, parser=parser)
|
||||
|
||||
|
||||
def find_tests():
|
||||
import unittest, tempfile, os
|
||||
from calibre.constants import iswindows
|
||||
@ -61,7 +66,7 @@ def find_tests():
|
||||
raw = templ.format(id=tid, val=val)
|
||||
err = None
|
||||
try:
|
||||
root = safe_xml_fromstring(raw) if safe else etree.fromstring(raw)
|
||||
root = safe_xml_fromstring(raw) if safe else unsafe_xml_fromstring(raw)
|
||||
except Exception as e:
|
||||
err = str(e)
|
||||
root = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user