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-118760: Restore the default value of tkinter.wantobjects to 1 #118784

Merged
merged 2 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2169,16 +2169,6 @@ Changes in the Python API
returned by :meth:`zipfile.ZipFile.open` was changed from ``'r'`` to ``'rb'``.
(Contributed by Serhiy Storchaka in :gh:`115961`.)

* Callbacks registered in the :mod:`tkinter` module now take arguments as
various Python objects (``int``, ``float``, ``bytes``, ``tuple``),
not just ``str``.
To restore the previous behavior set :mod:`!tkinter` module global
:data:`!wantobject` to ``1`` before creating the
:class:`!Tk` object or call the :meth:`!wantobject`
method of the :class:`!Tk` object with argument ``1``.
Calling it with argument ``2`` restores the current default behavior.
(Contributed by Serhiy Storchaka in :gh:`66410`.)


Changes in the C API
--------------------
Expand Down
2 changes: 1 addition & 1 deletion Lib/tkinter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from tkinter.constants import *
import re

wantobjects = 2
wantobjects = 1
_debug = False # set to True to print executed Tcl/Tk commands

TkVersion = float(_tkinter.TK_VERSION)
Expand Down
7 changes: 4 additions & 3 deletions Misc/NEWS.d/3.13.0b1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1346,9 +1346,10 @@ urllib.
.. nonce: du4UKW
.. section: Library

Callbacks registered in the :mod:`tkinter` module now take arguments as
various Python objects (``int``, ``float``, ``bytes``, ``tuple``), not just
``str``. To restore the previous behavior set :mod:`!tkinter` module global
Add support for passing arguments to callbacks registered in the :mod:`tkinter`
module as various Python objects (``int``, ``float``, ``bytes``, ``tuple``),
corresponding to the original Tcl value, not just ``str``, and enable this by default.
To restore the previous behavior set :mod:`!tkinter` module global
Copy link
Member

Choose a reason for hiding this comment

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

This does not make sense when the value already is 1.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is an edited NEWS entry for 3.13.0b1.

Copy link
Member

Choose a reason for hiding this comment

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

The change to 3.13 what's new suggests that the change to wantobjects will be backported also. 'Restoring' 1 to 1 is what I questioned.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an edited NEWS entry for 3.13.0b1. We cannot simply remove it, because it is the part of the history, and 3.13.0b1 was already released with the bug.

But I reworded it, focusing on the possibility to change the behavior and adding that it was changed by default (not for long, for 3.13.0b1 only). So "restoring" here refers to the changed default. How to write this better? Maybe just remove all starting from "To restore"? And add the description of how to enable the experimental feature in the new NEWS entry for 3.13.0b2?

:data:`~tkinter.wantobject` to ``1`` before creating the
:class:`~tkinter.Tk` object or call the :meth:`~tkinter.Tk.wantobject`
method of the :class:`!Tk` object with argument ``1``. Calling it with
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restore the default value of ``tkiter.wantobjects`` to ``1``.
Loading