mirror of
https://github.com/python/cpython
synced 2026-09-28 01:13:17 +03:00
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.
This commit is contained in:
parent
5d2794a16b
commit
d2c4baa41f
5 changed files with 59 additions and 28 deletions
|
|
@ -469,6 +469,12 @@ tkinter
|
|||
a dict instead of a tuple.
|
||||
(Contributed by Serhiy Storchaka in :gh:`43457`.)
|
||||
|
||||
* Add new optional keyword-only parameter *return_ints* in
|
||||
the :meth:`!Text.count` method.
|
||||
Passing ``return_ints=True`` makes it always returning the single count
|
||||
as an integer instead of a 1-tuple or ``None``.
|
||||
(Contributed by Serhiy Storchaka in :gh:`97928`.)
|
||||
|
||||
* Add support of the "vsapi" element type in
|
||||
the :meth:`~tkinter.ttk.Style.element_create` method of
|
||||
:class:`tkinter.ttk.Style`.
|
||||
|
|
@ -1286,13 +1292,6 @@ that may require changes to your code.
|
|||
Changes in the Python API
|
||||
-------------------------
|
||||
|
||||
* :meth:`!tkinter.Text.count` now always returns an integer if one or less
|
||||
counting options are specified.
|
||||
Previously it could return a single count as a 1-tuple, an integer (only if
|
||||
option ``"update"`` was specified) or ``None`` if no items found.
|
||||
The result is now the same if ``wantobjects`` is set to ``0``.
|
||||
(Contributed by Serhiy Storchaka in :gh:`97928`.)
|
||||
|
||||
* Functions :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`,
|
||||
:c:func:`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`,
|
||||
:c:func:`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue