Skip to content

gh-145675: Raise SyntaxError when constants are used as an identifier#145690

Open
StanFromIreland wants to merge 1 commit intopython:mainfrom
StanFromIreland:errors
Open

gh-145675: Raise SyntaxError when constants are used as an identifier#145690
StanFromIreland wants to merge 1 commit intopython:mainfrom
StanFromIreland:errors

Conversation

@StanFromIreland
Copy link
Member

@StanFromIreland StanFromIreland commented Mar 9, 2026

@terryjreedy
Copy link
Member

An indicated on the issue, I agree with the proposed change.

Comment on lines 947 to 948
with self.assertRaisesRegex(ValueError, f"identifier field can't represent '{constant}' constant"):
compile(expr, "<test>", "eval")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the rub: when compiling an AST node, ValueError does make sense. And it would be nice for these two to be consistent.
Can't have all three.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants