beniget
beniget copied to clipboard
AttributeError: module 'gast' has no attribute 'MatchStar', when gast < 0.5.4 installed
Found during a source build of an old version of scipy
, which uses beniget
transitively during the build process. Installed packages were:
======== Resolution Result ========
Stable pins:
python None
numpy 1.23.2
cython 0.29.37
pybind11 2.10.4
pythran 0.12.2
meson-python 0.16.0
wheel 0.37.1
beniget 0.4.2.post1
gast 0.5.3
meson 1.4.1
packaging 24.1
ply 3.11
pyproject-metadata 0.8.0
The traceback seen is:
File "/tmp/pdm-build-env-hi55zv05-shared/lib/python3.11/site-packages/beniget/beniget.py", line 112, in name
elif isinstance(self.node, (ast.MatchStar, ast.MatchAs)):
^^^^^^^^^^^^^
AttributeError: module 'gast' has no attribute 'MatchStar'
gast
looks to have added support for MatchStar
in 0.5.4: https://github.com/serge-sans-paille/gast/compare/0.5.3...0.5.4#diff-44b67094998a7df1e5ce843b5a2faa44950f5896ac9e07ab99d09e2b24c90143R328
However, beniget
still only requires gast>0.5.0
: https://github.com/serge-sans-paille/beniget/blob/40d39542589d7ed6f9b881931b310c227b682b0b/requirements.txt#L1
I think that either requirements.txt
should be bumped to indicate a higher version of gast
is required, or documentation should be added that a certain level of gast
is required for newer python features like the match
statement.
I worked around my specific case by upgrading other packages that were causing gast 0.5.3
to be installed, so we no longer hit this case.