From a65789b6cb9dd1f196938e2a71db264e2128477a Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 8 May 2024 21:31:00 +0300 Subject: [PATCH] gh-118760: Restore the default value of tkiter.wantobjects to 1 It was set to 2 in 65f5e586a1239ed1a66d8284773d7b02ce40e480 (GH-98592). --- Doc/whatsnew/3.13.rst | 10 ---------- Lib/tkinter/__init__.py | 2 +- Misc/NEWS.d/3.13.0b1.rst | 7 ++++--- .../2024-05-08-21-30-33.gh-issue-118760.XvyMHn.rst | 1 + 4 files changed, 6 insertions(+), 14 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2024-05-08-21-30-33.gh-issue-118760.XvyMHn.rst diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 8e90faee667ded..7cd92304076e4f 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -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 -------------------- diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index daecf4eb2ea522..08bbf14e54cccc 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -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) diff --git a/Misc/NEWS.d/3.13.0b1.rst b/Misc/NEWS.d/3.13.0b1.rst index 8d49ff06efd07b..a7506f518c9be2 100644 --- a/Misc/NEWS.d/3.13.0b1.rst +++ b/Misc/NEWS.d/3.13.0b1.rst @@ -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 :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 diff --git a/Misc/NEWS.d/next/Library/2024-05-08-21-30-33.gh-issue-118760.XvyMHn.rst b/Misc/NEWS.d/next/Library/2024-05-08-21-30-33.gh-issue-118760.XvyMHn.rst new file mode 100644 index 00000000000000..0e2712c26b1c13 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-05-08-21-30-33.gh-issue-118760.XvyMHn.rst @@ -0,0 +1 @@ +Restore the default value of ``tkiter.wantobjects`` to ``1``.