summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-02-11 10:43:14 (GMT)
committerGitHub <noreply@github.com>2024-02-11 10:43:14 (GMT)
commitd2c4baa41ff93cd5695c201d40e20a88458ecc26 (patch)
tree9cd066f17f0aabe268312d469f94447a4063d592 /Lib/idlelib
parent5d2794a16bc1639e6053300c08a78d60526aadf2 (diff)
downloadcpython-d2c4baa41ff93cd5695c201d40e20a88458ecc26.zip
cpython-d2c4baa41ff93cd5695c201d40e20a88458ecc26.tar.gz
cpython-d2c4baa41ff93cd5695c201d40e20a88458ecc26.tar.bz2
gh-97928: Partially restore the behavior of tkinter.Text.count() by default (GH-115031)
By default, it preserves an inconsistent behavior of older Python versions: packs the count into a 1-tuple if only one or none options are specified (including 'update'), returns None instead of 0. Except that setting wantobjects to 0 no longer affects the result. Add a new parameter return_ints: specifying return_ints=True makes Text.count() always returning the single count as an integer instead of a 1-tuple or None.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/sidebar.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/idlelib/sidebar.py b/Lib/idlelib/sidebar.py
index ff77b56..aa19a24 100644
--- a/Lib/idlelib/sidebar.py
+++ b/Lib/idlelib/sidebar.py
@@ -27,7 +27,7 @@ def get_displaylines(text, index):
"""Display height, in lines, of a logical line in a Tk text widget."""
return text.count(f"{index} linestart",
f"{index} lineend",
- "displaylines")
+ "displaylines", return_ints=True)
def get_widget_padding(widget):
"""Get the total padding of a Tk widget, including its border."""