This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_tk.test_configure_type() fails with Tcl/Tk 8.6.11
Type: behavior Stage: resolved
Components: Tests, Tkinter Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: epaine, gpolo, lukasz.langa, miss-islington, ned.deily, serhiy.storchaka, terry.reedy, zach.ware
Priority: normal Keywords: patch

Created on 2021-10-11 20:27 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 29077 merged zach.ware, 2021-10-20 02:07
PR 29080 merged miss-islington, 2021-10-20 02:54
PR 29081 merged miss-islington, 2021-10-20 02:54
PR 29093 merged miss-islington, 2021-10-20 13:50
PR 29003 serhiy.storchaka, 2021-10-20 14:35
PR 28986 serhiy.storchaka, 2021-10-20 14:36
Messages (22)
msg403678 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-10-11 20:27
x86 Gentoo Non-Debug with X 3.x:
https://buildbot.python.org/all/#/builders/58/builds/891

test.pythoninfo:

tkinter.TCL_VERSION: 8.6
tkinter.TK_VERSION: 8.6
tkinter.info_patchlevel: 8.6.11

2 tests failed:
    test_tk test_ttk_guionly

======================================================================
FAIL: test_configure_type (tkinter.test.test_tkinter.test_widgets.MenuTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/test_tkinter/test_widgets.py", line 1244, in test_configure_type
    self.checkEnumParam(widget, 'type',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 151, in checkEnumParam
    self.checkInvalidParam(widget, name, '',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 73, in checkInvalidParam
    with self.assertRaises(tkinter.TclError) as cm:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: TclError not raised

======================================================================
FAIL: test_configure_compound (tkinter.test.test_ttk.test_widgets.ButtonTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/test_ttk/test_widgets.py", line 173, in test_configure_compound
    self.checkEnumParam(widget, 'compound',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 151, in checkEnumParam
    self.checkInvalidParam(widget, name, '',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 73, in checkInvalidParam
    with self.assertRaises(tkinter.TclError) as cm:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: TclError not raised

======================================================================
FAIL: test_configure_compound (tkinter.test.test_ttk.test_widgets.CheckbuttonTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/test_ttk/test_widgets.py", line 173, in test_configure_compound
    self.checkEnumParam(widget, 'compound',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 151, in checkEnumParam
    self.checkInvalidParam(widget, name, '',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 73, in checkInvalidParam
    with self.assertRaises(tkinter.TclError) as cm:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: TclError not raised

======================================================================
FAIL: test_configure_compound (tkinter.test.test_ttk.test_widgets.LabelTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/test_ttk/test_widgets.py", line 173, in test_configure_compound
    self.checkEnumParam(widget, 'compound',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 151, in checkEnumParam
    self.checkInvalidParam(widget, name, '',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 73, in checkInvalidParam
    with self.assertRaises(tkinter.TclError) as cm:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: TclError not raised

======================================================================
FAIL: test_configure_compound (tkinter.test.test_ttk.test_widgets.MenubuttonTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/test_ttk/test_widgets.py", line 173, in test_configure_compound
    self.checkEnumParam(widget, 'compound',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 151, in checkEnumParam
    self.checkInvalidParam(widget, name, '',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 73, in checkInvalidParam
    with self.assertRaises(tkinter.TclError) as cm:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: TclError not raised

======================================================================
FAIL: test_configure_compound (tkinter.test.test_ttk.test_widgets.RadiobuttonTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/test_ttk/test_widgets.py", line 173, in test_configure_compound
    self.checkEnumParam(widget, 'compound',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 151, in checkEnumParam
    self.checkInvalidParam(widget, name, '',
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.nondebug/build/Lib/tkinter/test/widget_tests.py", line 73, in checkInvalidParam
    with self.assertRaises(tkinter.TclError) as cm:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: TclError not raised
msg403680 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-10-11 20:28
See also bpo-43139: test_ttk test_compound and test_tk test_type fails with Tk 8.6.11.1.
msg403683 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-10-11 20:45
> 2 tests failed:test_tk test_ttk_guionly

They also failed on:

* x86 Gentoo Non-Debug with X 3.9
* x86 Gentoo Non-Debug with X 3.10
msg404338 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-10-19 19:15
EP, do you have any insight into these issues?  Why does 8.6.11 result in test failures?  Bug in our test or in tk?
msg404352 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-10-19 21:11
There are similar test failures on macOS with the current Tk 8.6.11.1 on both 3.10 and 3.11.
msg404385 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2021-10-20 02:13
AFAICT, this is just a couple of tests that are testing something that's no longer an error, though anyone with deeper knowledge is more than welcome to disagree with my diagnosis :).  I've posted PR29077 to fix the tests.

Ned and Łukasz, will you want this backported to security branches to fix the buildbot(s)?
msg404388 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2021-10-20 02:54
New changeset 4fe454c6f54b0948af67b53af6c2f35af6377e69 by Zachary Ware in branch 'main':
bpo-45436: Fix tkinter tests with Tcl/Tk 8.6.11+ (GH-29077)
https://github.com/python/cpython/commit/4fe454c6f54b0948af67b53af6c2f35af6377e69
msg404453 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-10-20 13:49
Zach, yes, at least to 3.10, 3.9, and 3.8 please.
msg404454 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-10-20 13:50
New changeset 15cd7a7f9edcc121f273ae1d8007128282f8f85f by Miss Islington (bot) in branch '3.9':
bpo-45436: Fix tkinter tests with Tcl/Tk 8.6.11+ (GH-29077) (GH-29081)
https://github.com/python/cpython/commit/15cd7a7f9edcc121f273ae1d8007128282f8f85f
msg404460 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-10-20 14:08
New changeset 2ce38167000fef3a71f1783acdda2a2cf7a2df39 by Miss Islington (bot) in branch '3.8':
bpo-45436: Fix tkinter tests with Tcl/Tk 8.6.11+ (GH-29077) (GH-29093)
https://github.com/python/cpython/commit/2ce38167000fef3a71f1783acdda2a2cf7a2df39
msg404465 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-10-20 14:31
New changeset b8dbb3a7f96718dddb8bed31130f421316213dc5 by Miss Islington (bot) in branch '3.10':
bpo-45436: Fix tkinter tests with Tcl/Tk 8.6.11+ (GH-29077) (GH-29080)
https://github.com/python/cpython/commit/b8dbb3a7f96718dddb8bed31130f421316213dc5
msg404471 - (view) Author: E. Paine (epaine) * Date: 2021-10-20 15:11
I suspect this is a bug with Tk. `-compound` accepting the empty string is not documented and the valid Ttk compound values listed in the source do not include it (https://github.com/tcltk/tk/blob/57451473/generic/ttk/ttkInit.c#L34-L37 - ignore the NULL at the end, this is required by `Tcl_GetIndexFromObjStruct`: https://github.com/tcltk/tcl/blob/e78868d6/generic/tclIndexObj.c#L187-L191). I therefore assume it must be a regression with one of the changes that was made to `Ttk_GetCompoundFromObj` between 8.6.10 and 8.6.11. I will investigate further and report it to the Tk team.

I have not fully investigated the issue with `test_configure_type` reported here and in bpo-43139, but again, the empty string is not documented as being valid.
msg404645 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-10-21 20:18
Thanks for the investigation, E. Paine. So I'm keeping this open then.
msg404653 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2021-10-21 20:45
I'm not sure there's much utility to keeping this issue open: the test failures are fixed with a mild but not unprecedented weakening of the tests, and Tcl/Tk 8.6.11 is in the wild and will remain there, so our tests are likely to need to continue handling its behavior (buggy or not) in perpetuity.

By all means, please continue pursuing the change with Tcl/Tk :).  I'm just not sure what else there is for us to do here.
msg404862 - (view) Author: E. Paine (epaine) * Date: 2021-10-23 09:38
It turns out the `test_configure_compound` change was intentional (https://core.tcl-lang.org/tk/tktview/46c2f088) and an empty string will use the value given by the style ("If set to the empty string (the default)..." https://www.tcl.tk/man/tcl/TkCmd/ttk_widget.html#M-compound).
msg404963 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2021-10-25 14:03
Thanks for tracking that down!  Any word on the tk Menu type parameter change?
msg404968 - (view) Author: E. Paine (epaine) * Date: 2021-10-25 14:56
> Any word on the tk Menu type parameter change?

I haven't submitted a bug report yet and want to do a little more research before I do so (the Tcl ticket system is quite difficult to search)
msg404969 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-10-25 14:58
Are there changes in handling empty values for other options? If yes, we perhaps need to add version-dependent tests for empty values instead of just skipping this case.
msg407818 - (view) Author: E. Paine (epaine) * Date: 2021-12-06 14:42
> Any word on the tk Menu type parameter change?

I'll admit to having completely forgot about this issue and not raising it with the Tk team. Manually trying this case on Tk 8.6.12 segfaults, so I really need to raise it. To reproduce the segfault, simply run the top command in Python, or the bottom command in Wish:

tk.Menu(type="")
menu .m -type {}
msg407855 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-12-06 18:53
import tkinter as tk
tk.Menu(type='')

crashes on current Windows 3.9-11 with 8.6.12
msg407927 - (view) Author: E. Paine (epaine) * Date: 2021-12-07 12:10
Fix merged upstream: https://core.tcl-lang.org/tk/tktview/be8f5b9f
Can issue be closed now?
msg412845 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2022-02-08 15:57
> Can issue be closed now?

I think so; if others disagree they can reopen it :)
History
Date User Action Args
2022-04-11 14:59:51adminsetgithub: 89599
2022-02-08 15:57:55zach.waresetstatus: open -> closed
type: behavior
messages: + msg412845

resolution: fixed
stage: commit review -> resolved
2021-12-07 12:10:42epainesetmessages: + msg407927
2021-12-06 18:53:40terry.reedysetmessages: + msg407855
2021-12-06 14:42:27epainesetmessages: + msg407818
2021-11-08 16:47:44vstinnersetnosy: - vstinner
2021-10-25 14:58:48serhiy.storchakasetmessages: + msg404969
2021-10-25 14:56:59epainesetmessages: + msg404968
2021-10-25 14:03:31zach.waresetmessages: + msg404963
2021-10-23 09:38:14epainesetmessages: + msg404862
2021-10-21 20:45:30zach.waresetmessages: + msg404653
stage: patch review -> commit review
2021-10-21 20:44:45zach.warelinkissue43139 superseder
2021-10-21 20:18:42lukasz.langasetmessages: + msg404645
2021-10-20 15:11:42epainesetmessages: + msg404471
2021-10-20 14:36:12serhiy.storchakasetpull_requests: + pull_request27366
2021-10-20 14:35:36serhiy.storchakasetpull_requests: + pull_request27365
2021-10-20 14:31:02lukasz.langasetmessages: + msg404465
2021-10-20 14:08:51lukasz.langasetmessages: + msg404460
2021-10-20 13:50:35lukasz.langasetmessages: + msg404454
2021-10-20 13:50:07miss-islingtonsetpull_requests: + pull_request27363
2021-10-20 13:49:31lukasz.langasetmessages: + msg404453
2021-10-20 02:54:53miss-islingtonsetpull_requests: + pull_request27349
2021-10-20 02:54:52miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request27348
2021-10-20 02:54:51zach.waresetmessages: + msg404388
2021-10-20 02:13:25zach.waresetnosy: + lukasz.langa

messages: + msg404385
versions: + Python 3.9
2021-10-20 02:07:06zach.waresetnosy: + zach.ware

pull_requests: + pull_request27346
stage: needs patch -> patch review
2021-10-19 21:24:39vstinnersettitle: test_tk.test_configure_type() failed on x86 Gentoo Non-Debug with X 3.x with Tcl/Tk 8.6.11 -> test_tk.test_configure_type() fails with Tcl/Tk 8.6.11
2021-10-19 21:11:23ned.deilysetversions: + Python 3.10
nosy: + ned.deily

messages: + msg404352

stage: patch review -> needs patch
2021-10-19 21:05:36ned.deilysetpull_requests: - pull_request27336
2021-10-19 19:28:23vstinnersettitle: test_tk.test_configure_type() failed on x86 Gentoo Non-Debug with X 3.x -> test_tk.test_configure_type() failed on x86 Gentoo Non-Debug with X 3.x with Tcl/Tk 8.6.11
2021-10-19 19:15:00terry.reedysetnosy: + terry.reedy
messages: + msg404338
2021-10-19 19:11:15serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request27336
2021-10-19 19:10:49terry.reedysetnosy: + epaine
2021-10-11 20:45:34vstinnersetmessages: + msg403683
2021-10-11 20:28:10vstinnersetmessages: + msg403680
2021-10-11 20:27:32vstinnersettitle: test_configure_type() failed on -> test_tk.test_configure_type() failed on x86 Gentoo Non-Debug with X 3.x
2021-10-11 20:27:07vstinnercreate