classification
Title: Setting image parameter of a button crashes with Cocoa Tk
Type: crash Stage: resolved
Components: macOS, Tkinter Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: Arfrever, Dima Pasechnik, miss-islington, ned.deily, python-dev, ronaldoussoren, serhiy.storchaka, zhtw1234
Priority: normal Keywords: patch

Created on 2013-11-23 13:09 by serhiy.storchaka, last changed 2021-02-04 19:19 by ned.deily. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23785 merged serhiy.storchaka, 2020-12-15 17:01
PR 23799 merged miss-islington, 2020-12-16 10:32
Messages (12)
msg203999 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-11-23 13:09
From msg202006:

With Cocoa Tk 8.5.15 or Cocoa Tk 8.6.1 on OS X 10.8.5, test_widgets.ButtonTest crashes Tk:

test_image (tkinter.test.test_tkinter.test_widgets.ButtonTest) ... 2013-11-03 01:52:53.498 pytest_10.8[82465:f07] *** Assertion failure in -[NSBitmapImageRep initWithCGImage:], /SourceCache/AppKit/AppKit-1187.40/AppKit.subproj/NSBitmapImageRep.m:1242
2013-11-03 01:52:53.499 pytest_10.8[82465:f07] An uncaught exception was raised
2013-11-03 01:52:53.499 pytest_10.8[82465:f07] Invalid parameter not satisfying: cgImage != NULL
2013-11-03 01:52:53.502 pytest_10.8[82465:f07] (
	0   CoreFoundation                      0x965eae8b __raiseError + 219
	1   libobjc.A.dylib                     0x956d152e objc_exception_throw + 230
	2   CoreFoundation                      0x9654a698 +[NSException raise:format:arguments:] + 136
	3   Foundation                          0x966a5364 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
	4   AppKit                              0x98a34525 -[NSBitmapImageRep initWithCGImage:] + 145
	5   Tk                                  0x00725a48 CreateNSImageWithPixmap + 151
	6   Tk                                  0x00725b1c TkMacOSXGetNSImageWithTkImage + 149
	7   Tk                                  0x0071eb2f TkpComputeButtonGeometry + 2550
	8   Tk                                  0x0069849d TkButtonWorldChanged + 470
	9   Tk                                  0x00698e99 ConfigureButton + 1981
	10  Tk                                  0x0069980f ButtonWidgetObjCmd + 440
	11  Tcl                                 0x00579c2f TclEvalObjvInternal + 770
	12  Tcl                                 0x0057ac1a Tcl_EvalObjv + 72
	13  _tkinter.so                         0x0055db81 Tkapp_Call + 673
        [...]
msg204008 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-23 13:34
New changeset 9d0a76349eda by Serhiy Storchaka in branch '3.3':
Issue #19733: Temporary disable test_image on MacOSX.
http://hg.python.org/cpython/rev/9d0a76349eda

New changeset 71e091ed2588 by Serhiy Storchaka in branch 'default':
Issue #19733: Temporary disable test_image on MacOSX.
http://hg.python.org/cpython/rev/71e091ed2588

New changeset 3912934e99ba by Serhiy Storchaka in branch '2.7':
Issue #19733: Temporary disable test_image on MacOSX.
http://hg.python.org/cpython/rev/3912934e99ba
msg204189 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2013-11-24 07:56
> New changeset 3912934e99ba by Serhiy Storchaka in branch '2.7':
> Issue #19733: Temporary disable test_image on MacOSX.
> http://hg.python.org/cpython/rev/3912934e99ba

This commit introduced SyntaxError in Lib/lib-tk/test/test_tkinter/test_widgets.py
msg204230 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-11-24 16:27
Oh-oh. Thank you Arfrever.
msg204231 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-24 16:27
New changeset 77e3e395f446 by Serhiy Storchaka in branch '2.7':
Fixed merging error in changeset 3912934e99ba (issue #19733).
http://hg.python.org/cpython/rev/77e3e395f446
msg379417 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-23 09:02
It looks like the test can be reenabled.

System: macOS 10.15, with Python 3.9 from Python.org

``python3.9 -m tkinter.test.test_tkinter.test_widgets`` runs without problems (571 tests, no crash), even if I remove the skip for test_image.

Likewise for ``python3.9 -m unittest discover tkinter.test.test_tkinter`` (703 tests)
msg383142 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-12-16 10:32
New changeset 5f0fe8ec70120f4586d08978b0911b436f82c421 by Serhiy Storchaka in branch 'master':
bpo-19733: Re-enable tests for -image option in Tkinter (GH-23785)
https://github.com/python/cpython/commit/5f0fe8ec70120f4586d08978b0911b436f82c421
msg383145 - (view) Author: miss-islington (miss-islington) Date: 2020-12-16 10:54
New changeset cd7412e3c4a2805009d0baa948cd4026d6fa6f3d by Miss Islington (bot) in branch '3.9':
bpo-19733: Re-enable tests for -image option in Tkinter (GH-23785)
https://github.com/python/cpython/commit/cd7412e3c4a2805009d0baa948cd4026d6fa6f3d
msg383392 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-12-19 17:49
Thank you for tracking it Ronald. Could this issue be closed now?
msg386478 - (view) Author: Dima Pasechnik (Dima Pasechnik) Date: 2021-02-04 12:29
was it tested on macOS 11.2 ?
Tests fail there with Python 3.9.1
msg386491 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-02-04 19:18
> was it tested on macOS 11.2 ?
> Tests fail there with Python 3.9.1

The change to re-enable the previously crashing test will first be released in 3.9.2 and AFAICT no longer causes a crash. There are other Tk-related test failures on macOS with Tk 8.6.11 but no crashes like this as far as I know.
msg386492 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-02-04 19:19
> The change to re-enable the previously crashing test will first be released in 3.9.2

It's also in the recently-released 3.10.0a5 release preview.
History
Date User Action Args
2021-02-04 19:19:58ned.deilysetmessages: + msg386492
2021-02-04 19:18:34ned.deilysetmessages: + msg386491
2021-02-04 12:29:42Dima Pasechniksetnosy: + Dima Pasechnik
messages: + msg386478
2020-12-22 09:12:18ronaldoussorensetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-12-19 17:49:00serhiy.storchakasetstatus: pending -> open

messages: + msg383392
2020-12-19 17:47:47serhiy.storchakasetstatus: open -> pending
2020-12-16 11:11:24ned.deilysethgrepos: - hgrepo395
2020-12-16 11:10:47ned.deilysetfiles: - IMAG0215(5).jpg
2020-12-16 11:10:22ned.deilysetmessages: - msg383148
2020-12-16 11:05:50zhtw1234setmessages: + msg383148
2020-12-16 11:04:40ned.deilysetmessages: - msg383147
2020-12-16 11:04:08ned.deilysetmessages: - msg383146
2020-12-16 11:03:39zhtw1234setmessages: + msg383147
2020-12-16 11:01:05zhtw1234setfiles: + IMAG0215(5).jpg

nosy: + zhtw1234
messages: + msg383146

hgrepos: + hgrepo395
2020-12-16 10:54:24miss-islingtonsetmessages: + msg383145
2020-12-16 10:32:46miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request22657
2020-12-16 10:32:10serhiy.storchakasetmessages: + msg383142
2020-12-15 17:01:14serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request22642
2020-10-23 09:02:34ronaldoussorensetmessages: + msg379417
2013-11-24 16:27:33python-devsetmessages: + msg204231
2013-11-24 16:27:03serhiy.storchakasetmessages: + msg204230
2013-11-24 07:56:27Arfreversetnosy: + Arfrever
messages: + msg204189
2013-11-23 13:34:54python-devsetnosy: + python-dev
messages: + msg204008
2013-11-23 13:09:46serhiy.storchakacreate