Skip to content

Commit e188527

Browse files
gh-118760: Restore the default value of tkinter.wantobjects to 1 (GH-118784)
It was set to 2 in 65f5e58 (GH-98592).
1 parent 6b80a5b commit e188527

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

Doc/whatsnew/3.13.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,16 +2177,6 @@ Changes in the Python API
21772177
returned by :meth:`zipfile.ZipFile.open` was changed from ``'r'`` to ``'rb'``.
21782178
(Contributed by Serhiy Storchaka in :gh:`115961`.)
21792179

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

21912181
Changes in the C API
21922182
--------------------

Lib/tkinter/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from tkinter.constants import *
4141
import re
4242

43-
wantobjects = 2
43+
wantobjects = 1
4444
_debug = False # set to True to print executed Tcl/Tk commands
4545

4646
TkVersion = float(_tkinter.TK_VERSION)

Misc/NEWS.d/3.13.0b1.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,13 +1346,13 @@ urllib.
13461346
.. nonce: du4UKW
13471347
.. section: Library
13481348
1349-
Callbacks registered in the :mod:`tkinter` module now take arguments as
1350-
various Python objects (``int``, ``float``, ``bytes``, ``tuple``), not just
1351-
``str``. To restore the previous behavior set :mod:`!tkinter` module global
1352-
:data:`~tkinter.wantobject` to ``1`` before creating the
1353-
:class:`~tkinter.Tk` object or call the :meth:`~tkinter.Tk.wantobject`
1354-
method of the :class:`!Tk` object with argument ``1``. Calling it with
1355-
argument ``2`` restores the current default behavior.
1349+
Setting the :mod:`!tkinter` module global :data:`~tkinter.wantobject` to ``2``
1350+
before creating the :class:`~tkinter.Tk` object or call the
1351+
:meth:`~tkinter.Tk.wantobject` method of the :class:`!Tk` object with argument
1352+
``2`` makes now arguments to callbacks registered in the :mod:`tkinter` module
1353+
to be passed as various Python objects (``int``, ``float``, ``bytes``, ``tuple``),
1354+
depending on their internal represenation in Tcl, instead of always ``str``.
1355+
:data:`!tkinter.wantobject` is now set to ``2`` by default.
13561356

13571357
..
13581358
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Restore the default value of ``tkiter.wantobjects`` to ``1``.

0 commit comments

Comments
 (0)