Author martin.panter
Recipients brett.cannon, martin.panter, thomaslee
Date 2016-10-26.04:32:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1477456358.26.0.788026632142.issue4347@psf.upfronthosting.co.za>
In-reply-to
Content
I occasionally get the following error, due to Parser/parsetok.o being older than Include/graminit.h.

./python -E -S -m sysconfig --generate-posix-vars ; if test $? -ne 0 ; then  echo "generate-posix-vars failed" ;  rm -f ./pybuilddir.txt ;  exit 1 ;  fi
Could not import runpy module
Traceback (most recent call last):
  File "/home/proj/python/cpython/Lib/runpy.py", line 14, in <module>
    import importlib.machinery # importlib first so we can test #15386 via -m
  File "/home/proj/python/cpython/Lib/importlib/__init__.py", line 57, in <module>
    import types
  File "/home/proj/python/cpython/Lib/types.py", line 166, in <module>
    import functools as _functools
  File "/home/proj/python/cpython/Lib/functools.py", line 345, in <module>
    _CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
  File "/home/proj/python/cpython/Lib/collections/__init__.py", line 428, in namedtuple
    exec(class_definition, namespace)
SystemError: invalid node 339 for PyAST_FromNode
generate-posix-vars failed
*** Error code 1

The best workaround for me (less brute force than removing the whole build tree) seems to be to add Parser/parsetok.c to the list of files to “touch” the timestamps of before building.

The dependency in Parser/parsetok.c on Include/graminit.h was added by <https://hg.python.org/cpython/diff/06f1e2fd05bc/Parser/parsetok.c>, presumably to support encoding declarations in Python source files. I haven’t tried, but perhaps to avoid pgen depending on its output, a quick fix would be to add #ifndef PGEN around the offending code. For Python 2, a Parser/parsetok_pgen.c wrapper file would have to added, like in revision 6e9dc970ac0e.
History
Date User Action Args
2016-10-26 04:32:38martin.pantersetrecipients: + martin.panter, brett.cannon, thomaslee
2016-10-26 04:32:38martin.pantersetmessageid: <1477456358.26.0.788026632142.issue4347@psf.upfronthosting.co.za>
2016-10-26 04:32:38martin.panterlinkissue4347 messages
2016-10-26 04:32:37martin.pantercreate