8000 bpo-46996: Remove support of Tcl/Tk < 8.5.12 (GH-31839) · python/cpython@c2e3c06 · GitHub
[go: up one dir, main page]

Skip to content

Commit c2e3c06

Browse files
bpo-46996: Remove support of Tcl/Tk < 8.5.12 (GH-31839)
1 parent 7aeb06f commit c2e3c06

File tree

10 files changed

+90
-216
lines changed

10 files changed

+90
-216
lines changed

Doc/library/tkinter.ttk.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
--------------
1414

1515
The :mod:`tkinter.ttk` module provides access to the Tk themed widget set,
16-
introduced in Tk 8.5. If Python has not been compiled against Tk 8.5, this
17-
module can still be accessed if *Tile* has been installed. The former
18-
method using Tk 8.5 provides additional benefits including anti-aliased font
16+
introduced in Tk 8.5. It provides additional benefits including anti-aliased font
1917
rendering under X11 and window transparency (requiring a composition
2018
window manager on X11).
2119

Doc/whatsnew/3.11.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,9 @@ Build Changes
712712
be removed at some point in the future. (Contributed by Mark Dickinson in
713713
:issue:`45569`.)
714714

715+
* The :mod:`tkinter` package now requires Tcl/Tk version 8.5.12 or newer.
716+
(Contributed by Serhiy Storchaka in :issue:`46996`.)
717+
715718

716719
C API Changes
717720
=============

Lib/test/test_tcl.py

Lines changed: 24 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -143,27 +143,18 @@ def testUnsetVarException(self):
143143
self.assertRaises(TclError,tcl.unsetvar,'a')
144144

145145
def get_integers(self):
146-
integers = (0, 1, -1, 2**31-1, -2**31, 2**31, -2**31-1, 2**63-1, -2**63)
147-
# bignum was added in Tcl 8.5, but its support is able only since 8.5.8.
148-
# Actually it is determined at compile time, so using get_tk_patchlevel()
149-
# is not reliable.
150-
# TODO: expose full static version.
151-
if tcl_version >= (8, 5):
152-
v = get_tk_patchlevel()
153-
if v >= (8, 6, 0, 'final') or (8, 5, 8) <= v < (8, 6):
154-
integers += (2**63, -2**63-1, 2**1000, -2**1000)
155-
return integers
146+
return (0, 1, -1,
147+
2**31-1, -2**31, 2**31, -2**31-1,
148+
2**63-1, -2**63, 2**63, -2**63-1,
149+
2**1000, -2**1000)
156150

157151
def test_getint(self):
158152
tcl = self.interp.tk
159153
for i in self.get_integers():
160154
self.assertEqual(tcl.getint(' %d ' % i), i)
161-
if tcl_version >= (8, 5):
162-
self.assertEqual(tcl.getint(' %#o ' % i), i)
155+
self.assertEqual(tcl.getint(' %#o ' % i), i)
163156
self.assertEqual(tcl.getint((' %#o ' % i).replace('o', '')), i)
164157
self.assertEqual(tcl.getint(' %#x ' % i), i)
165-
if tcl_version < (8, 5): # bignum was added in Tcl 8.5
166-
self.assertRaises(TclError, tcl.getint, str(2**1000))
167158
self.assertEqual(tcl.getint(42), 42)
168159
self.assertRaises(TypeError, tcl.getint)
169160
self.assertRaises(TypeError, tcl.getint, '42', '10')
@@ -317,8 +308,7 @@ def check(expr, expected):
317308
check('"a\xbd\u20ac"', 'a\xbd\u20ac')
318309
check(r'"a\xbd\u20ac"', 'a\xbd\u20ac')
319310
check(r'"a\0b"', 'a\x00b')
320-
if tcl_version >= (8, 5): # bignum was added in Tcl 8.5
321-
check('2**64', str(2**64))
311+
check('2**64', str(2**64))
322312

323313
def test_exprdouble(self):
324314
tcl = self.interp
@@ -349,8 +339,7 @@ def check(expr, expected):
349339
check('[string length "a\xbd\u20ac"]', 3.0)
350340
check(r'[string length "a\xbd\u20ac"]', 3.0)
351341
self.assertRaises(TclError, tcl.exprdouble, '"abc"')
352-
if tcl_version >= (8, 5): # bignum was added in Tcl 8.5
353-
check('2**64', float(2**64))
342+
check('2**64', float(2**64))
354343

355344
def test_exprlong(self):
356345
tcl = self.interp
@@ -381,8 +370,7 @@ def check(expr, expected):
381370
check('[string length "a\xbd\u20ac"]', 3)
382371
check(r'[string length "a\xbd\u20ac"]', 3)
383372
self.assertRaises(TclError, tcl.exprlong, '"abc"')
384-
if tcl_version >= (8, 5): # bignum was added in Tcl 8.5
385-
self.assertRaises(TclError, tcl.exprlong, '2**64')
373+
self.assertRaises(TclError, tcl.exprlong, '2**64')
386374

387375
def test_exprboolean(self):
388376
tcl = self.interp
@@ -422,10 +410,8 @@ def check(expr, expected):
422410
check('[string length "a\xbd\u20ac"]', True)
423411
check(r'[string length "a\xbd\u20ac"]', True)
424412
self.assertRaises(TclError, tcl.exprboolean, '"abc"')
425-
if tcl_version >= (8, 5): # bignum was added in Tcl 8.5
426-
check('2**64', True)
413+
check('2**64', True)
427414

428-
@unittest.skipUnless(tcl_version >= (8, 5), 'requires Tcl version >= 8.5')
429415
def test_booleans(self):
430416
tcl = self.interp
431417
def check(expr, expected):
@@ -455,8 +441,6 @@ def test_expr_bignum(self):
455441
else:
456442
self.assertEqual(result, str(i))
457443
self.assertIsInstance(result, str)
458-
if get_tk_patchlevel() < (8, 5): # bignum was added in Tcl 8.5
459-
self.assertRaises(TclError, tcl.call, 'expr', str(2**1000))
460444

461445
def test_passing_values(self):
462446
def passValue(value):
@@ -485,8 +469,6 @@ def passValue(value):
485469
b'str\xbding' if self.wantobjects else 'str\xbding')
486470
for i in self.get_integers():
487471
self.assertEqual(passValue(i), i if self.wantobjects else str(i))
488-
if tcl_version < (8, 5): # bignum was added in Tcl 8.5
489-
self.assertEqual(passValue(2**1000), str(2**1000))
490472
for f in (0.0, 1.0, -1.0, 1/3,
491473
sys.float_info.min, sys.float_info.max,
492474
-sys.float_info.min, -sys.float_info.max):
@@ -552,8 +534,6 @@ def float_eq(actual, expected):
552534
check(b'str\xc0\x80ing\xe2\x82\xac', 'str\xc0\x80ing\xe2\x82\xac')
553535
for i in self.get_integers():
554536
check(i, str(i))
555-
if tcl_version < (8, 5): # bignum was added in Tcl 8.5
556-
check(2**1000, str(2**1000))
557537
for f in (0.0, 1.0, -1.0):
558538
check(f, repr(f))
559539
for f in (1/3.0, sys.float_info.min, sys.float_info.max,
@@ -600,16 +580,14 @@ def test_splitlist(self):
600580
('1', '2', '3.4')),
601581
]
602582
tk_patchlevel = get_tk_patchlevel()
603-
if tcl_version >= (8, 5):
604-
if not self.wantobjects or tk_patchlevel < (8, 5, 5):
605-
# Before 8.5.5 dicts were converted to lists through string
606-
expected = ('12', '\u20ac', '\xe2\x82\xac', '3.4')
607-
else:
608-
expected = (12, '\u20ac', b'\xe2\x82\xac', (3.4,))
609-
testcases += [
610-
(call('dict', 'create', 12, '\u20ac', b'\xe2\x82\xac', (3.4,)),
611-
expected),
612-
]
583+
if not self.wantobjects:
584+
expected = ('12', '\u20ac', '\xe2\x82\xac', '3.4')
585+
else:
586+
expected = (12, '\u20ac', b'\xe2\x82\xac', (3.4,))
587+
testcases += [
588+
(call('dict', 'create', 12, '\u20ac', b'\xe2\x82\xac', (3.4,)),
589+
expected),
590+
]
613591
dbg_info = ('want objects? %s, Tcl version: %s, Tk patchlevel: %s'
614592
% (self.wantobjects, tcl_version, tk_patchlevel))
615593
for arg, res in testcases:
@@ -642,15 +620,13 @@ def test_splitdict(self):
642620
{'a': (1, 2, 3) if self.wantobjects else '1 2 3',
643621
'something': 'foo', 'status': ''})
644622

645-
if tcl_version >= (8, 5):
646-
arg = tcl.call('dict', 'create',
647-
'-a', (1, 2, 3), '-something', 'foo', 'status', ())
648-
if not self.wantobjects or get_tk_patchlevel() < (8, 5, 5):
649-
# Before 8.5.5 dicts were converted to lists through string
650-
expected = {'a': '1 2 3', 'something': 'foo', 'status': ''}
651-
else:
652-
expected = {'a': (1, 2, 3), 'something': 'foo', 'status': ''}
653-
self.assertEqual(splitdict(tcl, arg), expected)
623+
arg = tcl.call('dict', 'create',
624+
'-a', (1, 2, 3), '-something', 'foo', 'status', ())
625+
if not self.wantobjects:
626+
expected = {'a': '1 2 3', 'something': 'foo', 'status': ''}
627+
else:
628+
expected = {'a': (1, 2, 3), 'something': 'foo', 'status': ''}
629+
self.assertEqual(splitdict(tcl, arg), expected)
654630

655631
def test_join(self):
656632
join = tkinter._join

Lib/tkinter/test/test_tkinter/test_geometry_managers.py

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from tkinter import TclError
55 2851
from test.support import requires
66

7-
from tkinter.test.support import pixels_conv, tcl_version, requires_tcl
7+
from tkinter.test.support import pixels_conv
88
from tkinter.test.widget_tests import AbstractWidgetTest
99

1010
requires('gui')
@@ -295,8 +295,7 @@ def test_place_configure_in(self):
295295
with self.assertRaisesRegex(TclError, "can't place %s relative to "
296296
"itself" % re.escape(str(f2))):
297297
f2.place_configure(in_=f2)
298-
if tcl_version >= (8, 5):
299-
self.assertEqual(f2.winfo_manager(), '')
298+
self.assertEqual(f2.winfo_manager(), '')
300299
with self.assertRaisesRegex(TclError, 'bad window path name'):
301300
f2.place_configure(in_='spam')
302301
f2.place_configure(in_=f)
@@ -491,8 +490,7 @@ def tearDown(self):
491490
for i in range(rows + 1):
492491
self.root.grid_rowconfigure(i, weight=0, minsize=0, pad=0, uniform='')
493492
self.root.grid_propagate(1)
494-
if tcl_version >= (8, 5):
495-
self.root.grid_anchor('nw')
493+
self.root.grid_anchor('nw')
496494
super().tearDown()
497495

498496
def test_grid_configure(self):
@@ -619,16 +617,14 @@ def test_grid_columnconfigure(self):
619617
self.root.grid_columnconfigure((0, 3))
620618
b = tkinter.Button(self.root)
621619
b.grid_configure(column=0, row=0)
622-
if tcl_version >= (8, 5):
623-
self.root.grid_columnconfigure('all', weight=3)
624-
with self.assertRaisesRegex(TclError, 'expected integer but got "all"'):
625-
self.root.grid_columnconfigure('all')
626-
self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 3)
620+
self.root.grid_columnconfigure('all', weight=3)
621+
with self.assertRaisesRegex(TclError, 'expected integer but got "all"'):
622+
self.root.grid_columnconfigure('all')
623+
self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 3)
627624
self.assertEqual(self.root.grid_columnconfigure(3, 'weight'), 2)
628625
self.assertEqual(self.root.grid_columnconfigure(265, 'weight'), 0)
629-
if tcl_version >= (8, 5):
630-
self.root.grid_columnconfigure(b, weight=4)
631-
self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 4)
626+
self.root.grid_columnconfigure(b, weight=4)
627+
109AA self.assertEqual(self.root.grid_columnconfigure(0, 'weight'), 4)
632628

633629
def test_grid_columnconfigure_minsize(self):
634630
with self.assertRaisesRegex(TclError, 'bad screen distance "foo"'):
@@ -675,16 +671,14 @@ def test_grid_rowconfigure(self):
675671
self.root.grid_rowconfigure((0, 3))
676672
b = tkinter.Button(self.root)
677673
b.grid_configure(column=0, row=0)
678-
if tcl_version >= (8, 5):
679-
self.root.grid_rowconfigure('all', weight=3)
680-
with self.assertRaisesRegex(TclError, 'expected integer but got "all"'):
681-
self.root.grid_rowconfigure('all')
682-
self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 3)
674+
self.root.grid_rowconfigure('all', weight=3)
675+
with self.assertRaisesRegex(TclError, 'expected integer but got "all"'):
676+
self.root.grid_rowconfigure('all')
677+
self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 3)
683678
self.assertEqual(self.root.grid_rowconfigure(3, 'weight'), 2)
684679
self.assertEqual(self.root.grid_rowconfigure(265, 'weight'), 0)
685-
if tcl_version >= (8, 5):
686-
self.root.grid_rowconfigure(b, weight=4)
687-
self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 4)
680+
self.root.grid_rowconfigure(b, weight=4)
681+
self.assertEqual(self.root.grid_rowconfigure(0, 'weight'), 4)
688682

689683
def test_grid_rowconfigure_minsize(self):
690684
with self.assertRaisesRegex(TclError, 'bad screen distance "foo"'):
@@ -774,7 +768,6 @@ def test_grid_info(self):
774768
self.assertEqual(info['pady'], self._str(4))
775769
self.assertEqual(info['sticky'], 'ns')
776770

777-
@requires_tcl(8, 5)
778771
def test_grid_anchor(self):
779772
with self.assertRaisesRegex(TclError, 'bad anchor "x"'):
780773
self.root.grid_anchor('x')

0 commit comments

Comments
 (0)
0