On Thu, Dec 17, 2020 at 09:10:44PM +0100, Emilio Pozuelo Monfort wrote: > Hi, > > There's a regression in both buster and stretch in the last update of lxml > when running under Python 2: > > >>> import lxml.html.clean > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/usr/lib/python2.7/dist-packages/lxml/html/clean.py", line 73, in > <module> > r'</?[a-zA-Z]+|\son[a-zA-Z]+\s*=', re.ASCII).search > AttributeError: 'module' object has no attribute 'ASCII' > >>> > > The fix is [1]. > > I recently added support to run the tests to lxml (see #976148). When > enabling the test suite, this bug is exposed (tested in stretch, should be > similar in buster): > > python2.7 test.py -vv > Traceback (most recent call last): > File "test.py", line 625, in <module> > exitcode = main(sys.argv) > File "test.py", line 562, in main > test_cases = get_test_cases(test_files, cfg, cov=cov) > File "test.py", line 268, in get_test_cases > module = import_module(file, cfg, cov=cov) > File "test.py", line 209, in import_module > mod = __import__(modname) > File "/build/lxml-3.7.1/src/lxml/html/tests/test_clean.py", line 6, in > <module> > from lxml.html.clean import Cleaner, clean_html > File "/build/lxml-3.7.1/src/lxml/html/clean.py", line 73, in <module> > r'</?[a-zA-Z]+|\son[a-zA-Z]+\s*=', re.ASCII).search > AttributeError: 'module' object has no attribute 'ASCII' > > And with the patch applied, the tests run, although some of the clean tests > are failing, probably because the last patch didn't backport the test suite > changes (which was not a problem as the tests weren't being run). > > Roberto, my changes for stretch are in [3]. Would you like to take a look at > this and finish it (probably backporting the test changes from [2]) or > should I? > > Moritz, if you want I can look at buster too.
Ack, please do. The code is all quite similar across older distros from what I remember. Cheers, Moritz