Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] SyntaxError when using "None" as a name (Python keyword) #145

Open
fsahmad opened this issue Jan 18, 2021 · 0 comments
Open

[Python] SyntaxError when using "None" as a name (Python keyword) #145

fsahmad opened this issue Jan 18, 2021 · 0 comments

Comments

@fsahmad
Copy link

fsahmad commented Jan 18, 2021

Python binding cannot be imported because of the following error when the reserved keyword "None" is used as a enum value:

SyntaxError: cannot assign to None

Encountered the problem when using "None" as the name for an enum value, but similar issues are bound to happen elsewhere. Example IDL to reproduce:

	<enum name="DisplayMode">
		<option name="None" value="0"/>
		<option name="Value" value="1"/>
		<option name="Name" value="2"/>
		<option name="Both" value="3"/>
	</enum>

Generated binding:

'''Definition of AttributeDisplayMode
'''
class AttributeDisplayMode(CTypesEnum):
    None = 0
    Value = 1
    Name = 2
    Both = 3

At the very least, ACT should report an error in this case so another name can be used. Alternatively, lower/uppercase could be used (none/NONE) to prevent collisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant