-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Too Easy for Briefcase Apps to Clash with (semi-)Reserved Python Names #853
Comments
We already have a blocklist, populated with Python, Java, and Windows reserved words; this was introduced in #565 specifically as a response to #460 - the name "switch" is a reserved word in Java. That list only uses language reserved words; extending it to include "names of modules in the Python standard library", plus some other key names of interest like "test" and "main" seems like a simple fix. It probably doesn't even need to be the full standard library - I'd be surprised if someone called their app Yes, this will ultimately be whack-a-mole - but I think the moles will eventually become fairly endangered species as we add classes of names to this list :-) |
I meant to add that I created this when I realized there wasn't a reliable list of semi-reserved names in Python. To that end, Python 3.10 introduced sys.stdlib_module_names...although, I found at least some debate about how this should be used/trusted. The Another (bit half baked) idea I had was to preform a check to see if the user-provided name could be imported...the user could at least be warned about potentially creating a name clash then, A bit aged but this is documenting in some depth how to find available modules. At any rate.... |
I'm looking into this for the sprint |
Fixed in #1238. |
Describe the bug
When a user creates a Briefcase app, the Formal Name is used as the internal name to reference and invoke the app. It includes the app's module name and entry point name among others. Therefore, unintuitive runtime errors can occur when this name collides with the standard library's module namespace or even its (pseudo-)entry points.
To Reproduce
Some examples:
socket
will immediately error since this is an existing module in the standard library that's imported early.test
may run the CPython test suite (as in does with a packaged Flatpak).main
incurs aRecursionError
because default Briefcase entry point is also namedmain
.Expected behavior
Briefcase should tell the user these names are not allowed or avoid name clashes altogether.
briefcase_
(for instance) seems undesirable.The text was updated successfully, but these errors were encountered: