Python 3.9: module '_ast' has no attribute 'Index'
FelixSchwarz opened this issue · 6 comments
python-genshi fails to build with Python 3.9.0a5:
Traceback (most recent call last):
File "/usr/lib64/python3.9/doctest.py", line 1329, in __run
exec(compile(example.source, filename, "single",
File "<doctest genshi.template.eval.Expression[3]>", line 1, in <module>
Expression('items[-1]').evaluate(data)
File "/builddir/build/BUILD/python3-python-genshi-0.7.3-5.fc33/build/lib/genshi/template/eval.py", line 93, in __init__
self.code = _compile(node, self.source, mode=self.mode,
File "/builddir/build/BUILD/python3-python-genshi-0.7.3-5.fc33/build/lib/genshi/template/eval.py", line 451, in _compile
tree = xform().visit(node)
File "/builddir/build/BUILD/python3-python-genshi-0.7.3-5.fc33/build/lib/genshi/template/astutil.py", line 798, in visit
return visitor(node)
File "/builddir/build/BUILD/python3-python-genshi-0.7.3-5.fc33/build/lib/genshi/template/astutil.py", line 820, in _clone
value = self.visit(value)
File "/builddir/build/BUILD/python3-python-genshi-0.7.3-5.fc33/build/lib/genshi/template/astutil.py", line 798, in visit
return visitor(node)
File "/builddir/build/BUILD/python3-python-genshi-0.7.3-5.fc33/build/lib/genshi/template/eval.py", line 640, in visit_Subscript
not isinstance(node.slice, _ast.Index):
AttributeError: module '_ast' has no attribute 'Index'
For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01321086-python-genshi/
Downstream bug: python-genshi fails to build with Python 3.9: module '_ast' has no attribute 'Index'
I checked the test cases yesterday (briefly) and there are also other test failures. Help is appreciated.
The build logs above have been cleaned up but you can retrieve the latest logs from COPR: https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/python-genshi/
I started working on this. As a first step I'll try to get a single source version (without 2to3
) which will ease testing against Python 3.9 considerably. Part of that is dropping support for ancient Python 2 versions (Python 2.4/2.5). We might be able to drop Python 2 support completely but I think this won't make fixing this bug much easier so I'll just do what I think is really necessary.
I'll try to push my changes frequently to the branches in my repo (with a lot of history rewriting etc). Help is welcome so feel free to join :-)
just fyi: all tests pass with my branch wip-fix-py39index. The branch needs to be cleaned up and probably some changes could be solved more elegantly but I think the main work is done.
#27 should fix this issue. I'd be glad for a review as I don't know much about Python's AST.