summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2021-12-22 12:44:42 -0800
committerGreg Becker <becker33@llnl.gov>2022-01-12 06:14:18 -0800
commit396c37d82f1d05084a9d4ba3a08775ef160f4604 (patch)
tree7bb874d11b8e7780eeda511ac1e9ad5aad8ca560 /etc
parentafb358313aacfb8bf63c8dc084eea17c7903b9f8 (diff)
downloadspack-396c37d82f1d05084a9d4ba3a08775ef160f4604.tar.gz
spack-396c37d82f1d05084a9d4ba3a08775ef160f4604.tar.bz2
spack-396c37d82f1d05084a9d4ba3a08775ef160f4604.tar.xz
spack-396c37d82f1d05084a9d4ba3a08775ef160f4604.zip
unparser: implement operator precedence algorithm for unparser
Backport operator precedence algorithm from here: https://github.com/python/cpython/commit/397b96f6d7a89f778ebc0591e32216a8183fe667 This eliminates unnecessary parentheses from our unparsed output and makes Spack's unparser consistent with the one in upstream Python 3.9+, with one exception. Our parser normalizes argument order when `py_ver_consistent` is set, so that star arguments in function calls come last. We have to do this because Python 2's AST doesn't have information about their actual order. If we ever support only Python 3.9 and higher, we can easily switch over to `ast.unparse`, as the unparsing is consistent except for this detail (modulo future changes to `ast.unparse`)
Diffstat (limited to 'etc')
0 files changed, 0 insertions, 0 deletions