Skip to content

Commit 7405c5b

Browse files
Merge remote-tracking branch 'upstream/main' into gh-128133-bytes_hash-atomics
2 parents 9a27a3e + a626f9a commit 7405c5b

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

Lib/test/test_tkinter/test_misc.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
from tkinter import TclError
55
import enum
66
from test import support
7-
from test.test_tkinter.support import AbstractTkTest, AbstractDefaultRootTest, requires_tk
7+
from test.test_tkinter.support import (AbstractTkTest, AbstractDefaultRootTest,
8+
requires_tk, get_tk_patchlevel)
89

910
support.requires('gui')
1011

@@ -554,6 +555,31 @@ def test_wm_attribute(self):
554555
self.assertEqual(w.wm_attributes('alpha'),
555556
1.0 if self.wantobjects else '1.0')
556557

558+
def test_wm_iconbitmap(self):
559+
t = tkinter.Toplevel(self.root)
560+
self.assertEqual(t.wm_iconbitmap(), '')
561+
t.wm_iconbitmap('hourglass')
562+
bug = False
563+
if t._windowingsystem == 'aqua':
564+
# Tk bug 13ac26b35dc55f7c37f70b39d59d7ef3e63017c8.
565+
patchlevel = get_tk_patchlevel(t)
566+
if patchlevel < (8, 6, 17) or (9, 0) <= patchlevel < (9, 0, 2):
567+
bug = True
568+
if not bug:
569+
self.assertEqual(t.wm_iconbitmap(), 'hourglass')
570+
self.assertEqual(self.root.wm_iconbitmap(), '')
571+
t.wm_iconbitmap('')
572+
self.assertEqual(t.wm_iconbitmap(), '')
573+
574+
if t._windowingsystem == 'win32':
575+
t.wm_iconbitmap(default='hourglass')
576+
self.assertEqual(t.wm_iconbitmap(), 'hourglass')
577+
self.assertEqual(self.root.wm_iconbitmap(), '')
578+
t.wm_iconbitmap(default='')
579+
self.assertEqual(t.wm_iconbitmap(), '')
580+
581+
t.destroy()
582+
557583

558584
class EventTest(AbstractTkTest, unittest.TestCase):
559585

Lib/tkinter/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,7 @@ def wm_iconbitmap(self, bitmap=None, default=None):
22652265
explicitly. DEFAULT can be the relative path to a .ico file
22662266
(example: root.iconbitmap(default='myicon.ico') ). See Tk
22672267
documentation for more information."""
2268-
if default:
2268+
if default is not None:
22692269
return self.tk.call('wm', 'iconbitmap', self._w, '-default', default)
22702270
else:
22712271
return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix resetting the default window icon by passing ``default=''`` to the
2+
:mod:`tkinter` method :meth:`!wm_iconbitmap`.

Python/frame.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ _PyFrame_MakeAndSetFrameObject(_PyInterpreterFrame *frame)
4040
// here.
4141
assert(frame->frame_obj == NULL);
4242
assert(frame->owner != FRAME_OWNED_BY_FRAME_OBJECT);
43-
assert(frame->owner != FRAME_CLEARED);
4443
f->f_frame = frame;
4544
frame->frame_obj = f;
4645
return f;
@@ -51,7 +50,6 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
5150
{
5251
assert(frame->owner != FRAME_OWNED_BY_CSTACK);
5352
assert(frame->owner != FRAME_OWNED_BY_FRAME_OBJECT);
54-
assert(frame->owner != FRAME_CLEARED);
5553
Py_ssize_t size = ((char*)frame->stackpointer) - (char *)frame;
5654
memcpy((_PyInterpreterFrame *)f->_f_frame_data, frame, size);
5755
frame = (_PyInterpreterFrame *)f->_f_frame_data;

0 commit comments

Comments
 (0)