Skip to content

Commit 6716d60

Browse files
Issue #22085: Dropped support of Tk 8.3 in Tkinter.
1 parent f44611c commit 6716d60

File tree

3 files changed

+19
-31
lines changed

3 files changed

+19
-31
lines changed

Lib/tkinter/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def trace_variable(self, mode, callback):
245245
Return the name of the callback.
246246
"""
247247
cbname = self._master._register(callback)
248-
self._tk.call("trace", "variable", self._name, mode, cbname)
248+
self._tk.call("trace", "add", "variable", self._name, mode, cbname)
249249
return cbname
250250
trace = trace_variable
251251
def trace_vdelete(self, mode, cbname):
@@ -254,12 +254,12 @@ def trace_vdelete(self, mode, cbname):
254254
MODE is one of "r", "w", "u" for read, write, undefine.
255255
CBNAME is the name of the callback returned from trace_variable or trace.
256256
"""
257-
self._tk.call("trace", "vdelete", self._name, mode, cbname)
257+
self._tk.call("trace", "remove", "variable", self._name, mode, cbname)
258258
self._master.deletecommand(cbname)
259259
def trace_vinfo(self):
260260
"""Return all trace callback information."""
261261
return [self._tk.split(x) for x in self._tk.splitlist(
262-
self._tk.call("trace", "vinfo", self._name))]
262+
self._tk.call("trace", "info", "variable", self._name))]
263263
def __eq__(self, other):
264264
"""Comparison for equality (==).
265265
@@ -3789,8 +3789,7 @@ def panes(self):
37893789
def _test():
37903790
root = Tk()
37913791
text = "This is Tcl/Tk version %s" % TclVersion
3792-
if TclVersion >= 8.1:
3793-
text += "\nThis should be a cedilla: \xe7"
3792+
text += "\nThis should be a cedilla: \xe7"
37943793
label = Label(root, text=text)
37953794
label.pack()
37963795
test = Button(root, text="Click me!",

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ Core and Builtins
113113
Library
114114
-------
115115

116+
- Issue #22085: Dropped support of Tk 8.3 in Tkinter.
117+
116118
- Issue #21580: Now Tkinter correctly handles bytes arguments passed to Tk.
117119
In particular this allows to initialize images from binary data.
118120

Modules/_tkinter.c

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Copyright (C) 1994 Steen Lumholt.
99

1010
/* TCL/TK VERSION INFO:
1111
12-
Only Tcl/Tk 8.3.1 and later are supported. Older versions are not
13-
supported. Use Python 2.6 or older if you cannot upgrade your
12+
Only Tcl/Tk 8.4 and later are supported. Older versions are not
13+
supported. Use Python 3.4 or older if you cannot upgrade your
1414
Tcl/Tk libraries.
1515
*/
1616

@@ -36,13 +36,6 @@ Copyright (C) 1994 Steen Lumholt.
3636
#define CHECK_SIZE(size, elemsize) \
3737
((size_t)(size) <= Py_MAX((size_t)INT_MAX, UINT_MAX / (size_t)(elemsize)))
3838

39-
/* Starting with Tcl 8.4, many APIs offer const-correctness. Unfortunately,
40-
making _tkinter correct for this API means to break earlier
41-
versions. USE_COMPAT_CONST allows to make _tkinter work with both 8.4 and
42-
earlier versions. Once Tcl releases before 8.4 don't need to be supported
43-
anymore, this should go. */
44-
#define USE_COMPAT_CONST
45-
4639
/* If Tcl is compiled for threads, we must also define TCL_THREAD. We define
4740
it always; if Tcl is not threaded, the thread functions in
4841
Tcl are empty. */
@@ -58,15 +51,8 @@ Copyright (C) 1994 Steen Lumholt.
5851

5952
#include "tkinter.h"
6053

61-
/* For Tcl 8.2 and 8.3, CONST* is not defined (except on Cygwin). */
62-
#ifndef CONST84_RETURN
63-
#define CONST84_RETURN
64-
#undef CONST
65-
#define CONST
66-
#endif
67-
68-
#if TK_VERSION_HEX < 0x08030102
69-
#error "Tk older than 8.3.1 not supported"
54+
#if TK_VERSION_HEX < 0x08040002
55+
#error "Tk older than 8.4 not supported"
7056
#endif
7157

7258
#if !(defined(MS_WINDOWS) || defined(__CYGWIN__))
@@ -376,10 +362,10 @@ unicodeFromTclObj(Tcl_Obj *value)
376362

377363

378364
static PyObject *
379-
Split(char *list)
365+
Split(const char *list)
380366
{
381367
int argc;
382-
char **argv;
368+
const char **argv;
383369
PyObject *v;
384370

385371
if (list == NULL) {
@@ -481,7 +467,7 @@ SplitObj(PyObject *arg)
481467
}
482468
else if (PyUnicode_Check(arg)) {
483469
int argc;
484-
char **argv;
470+
const char **argv;
485471
char *list = PyUnicode_AsUTF8(arg);
486472

487473
if (list == NULL ||
@@ -496,7 +482,7 @@ SplitObj(PyObject *arg)
496482
}
497483
else if (PyBytes_Check(arg)) {
498484
int argc;
499-
char **argv;
485+
const char **argv;
500486
char *list = PyBytes_AsString(arg);
501487

502488
if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) {
@@ -563,8 +549,9 @@ static void EnableEventHook(void); /* Forward */
563549
static void DisableEventHook(void); /* Forward */
564550

565551
static TkappObject *
566-
Tkapp_New(char *screenName, char *className,
567-
int interactive, int wantobjects, int wantTk, int sync, char *use)
552+
Tkapp_New(const char *screenName, const char *className,
553+
int interactive, int wantobjects, int wantTk, int sync,
554+
const char *use)
568555
{
569556
TkappObject *v;
570557
char *argv0;
@@ -1857,7 +1844,7 @@ Tkapp_SplitList(PyObject *self, PyObject *args)
18571844
{
18581845
char *list;
18591846
int argc;
1860-
char **argv;
1847+
const char **argv;
18611848
PyObject *arg, *v;
18621849
int i;
18631850

@@ -1984,7 +1971,7 @@ PythonCmd_Error(Tcl_Interp *interp)
19841971
* function or method.
19851972
*/
19861973
static int
1987-
PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
1974+
PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[])
19881975
{
19891976
PythonCmd_ClientData *data = (PythonCmd_ClientData *)clientData;
19901977
PyObject *func, *arg, *res;

0 commit comments

Comments
 (0)