Skip to content

Commit

Permalink
[3.13] gh-118760: Restore the default value of tkinter.wantobjects to…
Browse files Browse the repository at this point in the history
… 1 (GH-118784) (GH-119251)

It was set to 2 in 65f5e58 (GH-98592).
(cherry picked from commit e188527)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
miss-islington and serhiy-storchaka authored May 20, 2024
1 parent 906f6cb commit b4462aa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
10 changes: 0 additions & 10 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2177,16 +2177,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
14 changes: 7 additions & 7 deletions Misc/NEWS.d/3.13.0b1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1346,13 +1346,13 @@ 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
: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
argument ``2`` restores the current default behavior.
Setting the :mod:`!tkinter` module global :data:`~tkinter.wantobject` to ``2``
before creating the :class:`~tkinter.Tk` object or call the
:meth:`~tkinter.Tk.wantobject` method of the :class:`!Tk` object with argument
``2`` makes now arguments to callbacks registered in the :mod:`tkinter` module
to be passed as various Python objects (``int``, ``float``, ``bytes``, ``tuple``),
depending on their internal represenation in Tcl, instead of always ``str``.
:data:`!tkinter.wantobject` is now set to ``2`` by default.

..
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restore the default value of ``tkiter.wantobjects`` to ``1``.

0 comments on commit b4462aa

Please sign in to comment.