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

gh-116484: Fix collisions between Checkbutton and ttk.Checkbutton default names #116495

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Mar 8, 2024

Change automatically generated tkinter.Checkbutton widget names to avoid collisions with automatically generated tkinter.ttk.Checkbutton widget names within the same parent widget.

…n default names

Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
@serhiy-storchaka serhiy-storchaka added needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes labels Mar 8, 2024
@terryjreedy terryjreedy changed the title gh-16484: Fix collisions between Checkbutton and ttk.Checkbutton default names gh-116484: Fix collisions between Checkbutton and ttk.Checkbutton default names Mar 12, 2024
@terryjreedy
Copy link
Member

I read the diff but want to look at more of the tk/ttk code before commenting. Will try to do so after mentor meeting tomorrow.

@BartolHrg
Copy link

The proposed solution is to add "_" in-between"!checkbutton" and the number (e.g. "!checkbutton_2").
But there might be a problem if someone names some class Checkbutton_

You might want to consider using some character that cannot be used in a Python variable name like '-' ("!checkbutton-2")

@terryjreedy
Copy link
Member

While I think a user is more likely to define Checkbutton_ than Checkbutton, I think doing so without either inheriting from tk.Checkbutton or defining .setup could be considered buggy. Still, adding '-' instead of '' is fine with me unless there is a reason against that I cannot think of.

I otherwise approve of the patch.

@serhiy-storchaka
Copy link
Member Author

You might want to consider using some character that cannot be used in a Python variable name like '-' ("!checkbutton-2")

Good point. Even if this is not very likely, it is better to be safe.

@serhiy-storchaka serhiy-storchaka merged commit c61cb50 into python:main Mar 16, 2024
31 checks passed
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the tkinter-checkbutton-default-name branch March 16, 2024 11:31
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 16, 2024
…on default names (pythonGH-116495)

Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
(cherry picked from commit c61cb50)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 16, 2024

GH-116901 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Mar 16, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 16, 2024
…on default names (pythonGH-116495)

Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
(cherry picked from commit c61cb50)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 16, 2024

GH-116902 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Mar 16, 2024
serhiy-storchaka added a commit that referenced this pull request Mar 16, 2024
…ton default names (GH-116495) (GH-116901)

Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
(cherry picked from commit c61cb50)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Mar 16, 2024
…ton default names (GH-116495) (GH-116902)

Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
(cherry picked from commit c61cb50)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
vstinner pushed a commit to vstinner/cpython that referenced this pull request Mar 20, 2024
…on default names (pythonGH-116495)

Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
…on default names (pythonGH-116495)

Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
…on default names (pythonGH-116495)

Change automatically generated tkinter.Checkbutton widget names to
avoid collisions with automatically generated tkinter.ttk.Checkbutton
widget names within the same parent widget.
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

Successfully merging this pull request may close these issues.

None yet

3 participants