Skip to content

tkinter and IDLE tests depend on buggy Tk behavior for unmapped text widgets #159127

Description

@serhiy-storchaka

Several tests fail with Tcl/Tk 9.0.5 and 9.1.1:

  • test_tkinter.test_text.TextTest.test_count
  • idle_test.test_codecontext.CodeContextTest.test_toggle_code_context_event, test_update_code_context and test_jumptoline
  • idle_test.test_sidebar.LineNumbersTest.test_scroll

A text widget which has not been mapped yet has size 1x1, and Tk used to lay out its content in that area, putting every character on its own display line. This was fixed in 784c08a4c9: such a widget is now laid out at its requested size. The tests above depended on the old buggy behavior.

test_count expects a non-zero number of vertical pixels between the indices 1.3 and 1.5, but they are on the same display line, for which -ypixels returns zero. The codecontext tests scroll the text widget, but the code sample is shorter than the now visible height. test_scroll needs the real geometry of mapped widgets; it fails with Tk 8.6 too when run alone.

The fix is on core-9-0-branch after the 9.0.4 release and on trunk after 9.1.0, so this will affect all branches once Tk 9.0.5 and 9.1.1 are released.

Linked PRs

Activity

  1. added
    testsTests in the Lib/test dir
    type-bugAn unexpected behavior, bug, or error
    3.14bugs and security fixes
    3.15bugs and security fixes
    3.16new features, bugs and security fixes
    on Oct 10, 2026
  2. added 3 commits that reference this issue on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixes3.15bugs and security fixes3.16new features, bugs and security fixestestsTests in the Lib/test dirtopic-IDLEtopic-tkintertype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions