You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sphinx.pycode.ast.unparse does not understand operator precedence #7498
Easiest way to fix this will be to copy some of the approach from the python 3.9 ast.unparse, which needs #7497 in order to keep track of the current precedence level.
Activity
tk0miya commentedon Apr 17, 2020
Please mind we also need to support
Callable[[str, str], str]. This type hint also uses a tuple without parenthesis.eric-wieser commentedon Apr 17, 2020
Indeed, the idea would be to add parentheses only where needed, like
ast.unparsedoeseric-wieser commentedon Apr 17, 2020
Although note that
Callable[([str, str], str)]is perfectly correct, it just is unfortunately also ugly.tk0miya commentedon Apr 17, 2020
It seems
ast.unparse()usesitems_view()to generate common part of sequences. It's cool.eric-wieser commentedon Apr 17, 2020
Copying the entirety of
ast.unparseinto sphinx may also be a sensible option.tk0miya commentedon Apr 17, 2020
Reasonable. But we should notice about license issue to copy it.
Fix sphinx-doc#7498: understand operator precedence
tk0miya commentedon Oct 4, 2020
Fixed by #8265 now.