Argument-Clinic / cpython

The Python programming language
https://www.python.org/
Other
1 stars 0 forks source link

Refactor `Block` so that `output` is always a `str` or `None` #8

Open AlexWaygood opened 1 year ago

AlexWaygood commented 1 year ago

Block.output is incredibly un-type-safe at the moment:

https://github.com/Argument-Clinic/cpython/blob/49f238e78c36532bcbca7f9cd172703eb4df319b/Tools/clinic/clinic.py#L1710

Most of the time, it's a str, but whenever we're inside one of the methods called by DSLParser.parse(), it's a list of strings. See my essay in https://github.com/python/cpython/pull/106519#issue-1793736606 for more.