Since updating to Python 3.9.8, we get an error while using Black in our CI pipeline.
black....................................................................Failed
- hook id: black
- exit code: 1
Traceback (most recent call last):
File "../.cache/pre-commit/repol9drvp84/py_env-python3/bin/black", line 5, in <module>
from black import patched_main
File "../.cache/pre-commit/repol9drvp84/py_env-python3/lib/python3.9/site-packages/black/__init__.py", line 52, in <module>
from typed_ast import ast3, ast27
File "../.cache/pre-commit/repol9drvp84/py_env-python3/lib/python3.9/site-packages/typed_ast/ast3.py", line 40, in <module>
from typed_ast import _ast3
ImportError: ../.cache/pre-commit/repol9drvp84/py_env-python3/lib/python3.9/site-packages/typed_ast/_ast3.cpython-39-x86_64-linux-gnu.so: undefined symbol: _PyUnicode_DecodeUnicodeEscape
The error can be easily reproduced with:
% pip install typed_ast
% python3 -c 'from typed_ast import ast3'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError:
/usr/lib/python3/dist-packages/typed_ast/_ast3.cpython-39-x86_64-linux-gnu.so:
undefined symbol: _PyUnicode_DecodeUnicodeEscape
Currently the only workaround is downgrading to Python 3.9.7.
Is another fix available?
See also Bug#998854: undefined symbol: _PyUnicode_DecodeUnicodeEscape