@jimfulton I get your point on the comment restriction, but frankly I could find neither an example of a buildout config file in the wild using a comment after the section name, nor using the ";" semicolon as a trailing comment separator for a header line.
Note that this comment restriction would be only when using a header expression and does not apply otherwise, and that there are no other restrictions imposed on the Python expression beyond it being a valid expression

On the other hand adding a restriction that the expression cannot contain # or ; means that expression literals would not be able to contain this characters (and not only the variable names, which is already impossible as this would not parse to a valid expression during evaluation