msg257055 - (view) |
Author: hcdb (hcbd) |
Date: 2015-12-26 23:16 |
My 6 lines of code crash and cause a segmentation fault when using .zoom() on a PhotoImage in tkinter (run test.py) tested and crashed in python 2.7.6, 2.7.9, 3.4.2 & 3.4.3 on linux mint 17.3 and debian jessie ps. just learning to code python, so maybe i'm doing it wrong. |
|
|
msg257058 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2015-12-27 00:22 |
Can't reproduce a crash. What is your OS? What versions of your Python and Tk? Can you provide your image? |
|
|
msg257061 - (view) |
Author: hcdb (hcbd) |
Date: 2015-12-27 01:26 |
system 1: os: Linux Mint 17.3 (64bit Mate) python version: 2.7.6 python-tk version: 2.7.5-1ubuntu1 (according to packagemanager) python3 version 3.4.3 python3-tk version: 3.4.3-1~14.04.2 (according to packagemanager) running python in gdb on this system gives me these outputs: (gdb) run test2.py Starting program: /usr/bin/python test2.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff47ca700 (LWP 14639)] Program received signal SIGSEGV, Segmentation fault. memset () at ../sysdeps/x86_64/memset.S:80 80 ../sysdeps/x86_64/memset.S: No such file or directory. (gdb) backtrace #0 memset () at ../sysdeps/x86_64/memset.S:80 #1 0x00007ffff66ce4ad in ?? () from /usr/lib/x86_64-linux-gnu/libtk8.6.so #2 0x00007ffff66cffab in Tk_PhotoPutZoomedBlock () from /usr/lib/x86_64-linux-gnu/libtk8.6.so #3 0x00007ffff66cc12b in ?? () from /usr/lib/x86_64-linux-gnu/libtk8.6.so #4 0x00007ffff62c8337 in TclNRRunCallbacks () from /usr/lib/x86_64-linux-gnu/libtcl8.6.so #5 0x00007ffff6982030 in ?? () from /usr/lib/python2.7/lib-dynload/_tkinter.so #6 0x000000000049968d in PyEval_EvalFrameEx () #7 0x00000000004a090c in PyEval_EvalCodeEx () #8 0x0000000000499a52 in PyEval_EvalFrameEx () #9 0x00000000004a1634 in ?? () #10 0x000000000044e4a5 in PyRun_FileExFlags () #11 0x000000000044ec9f in PyRun_SimpleFileExFlags () #12 0x000000000044f904 in Py_Main () #13 0x00007ffff7818ec5 in __libc_start_main (main=0x44f9c2 , argc=2, argv=0x7fffffffe0b8, init=, fini=, rtld_fini=, stack_end=0x7fffffffe0a8) at libc-start.c:287 #14 0x0000000000578c4e in _start () --------------------------------------- system2: os: Debian Jessie (Gnome3) python version:2.7.9 python-tk version:2.7.8-2+b1 python3 version:3.4.2 python3-tk version: 3.4.2-1+b1 output from gdb from this system (gui.py is my program that does the same as test.py only loads more widgets: Starting program: /usr/bin/python gui.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff435d700 (LWP 10798)] Program received signal SIGSEGV, Segmentation fault. 0x00007ffff64ba07b in Tk_PhotoPutZoomedBlock () from /usr/lib/x86_64-linux-gnu/libtk8.6.so (gdb) backtrace #0 0x00007ffff64ba07b in Tk_PhotoPutZoomedBlock () from /usr/lib/x86_64-linux-gnu/libtk8.6.so #1 0x00007ffff64b6171 in ?? () from /usr/lib/x86_64-linux-gnu/libtk8.6.so #2 0x00007ffff6092a87 in TclNRRunCallbacks () from /usr/lib/x86_64-linux-gnu/libtcl8.6.so #3 0x00007ffff6ae53c0 in ?? () from /usr/lib/python2.7/lib-dynload/_tkinter.so #4 0x00000000004c9e05 in PyEval_EvalFrameEx () #5 0x00000000004c87a1 in PyEval_EvalCodeEx () #6 0x00000000004ca31a in PyEval_EvalFrameEx () #7 0x00000000004c87a1 in PyEval_EvalCodeEx () #8 0x00000000004ca31a in PyEval_EvalFrameEx () #9 0x00000000004ca592 in PyEval_EvalFrameEx () #10 0x00000000004ca592 in PyEval_EvalFrameEx () #11 0x00000000004ca592 in PyEval_EvalFrameEx () #12 0x00000000004e5fe8 in ?? () #13 0x00000000005045d8 in ?? () #14 0x00000000004eb950 in PyInstance_New () #15 0x00000000004caaa1 in PyEval_EvalFrameEx () #16 0x00000000004c87a1 in PyEval_EvalCodeEx () #17 0x00000000005030ef in ?? () #18 0x00000000004f8c72 in PyRun_FileExFlags () #19 0x00000000004f7d77 in PyRun_SimpleFileExFlags () #20 0x00000000004982f2 in Py_Main () ---Type to continue, or q to quit--- #21 0x00007ffff6f14b45 in __libc_start_main (main=0x497d80 , argc=2, argv=0x7fffffffe3b8, init=, fini=, rtld_fini=, stack_end=0x7fffffffe3a8) at libc-start.c:287 #22 0x0000000000497ca0 in _start () |
|
|
msg257067 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2015-12-27 07:15 |
Thank you. Can you provide your image? |
|
|
msg257077 - (view) |
Author: hcdb (hcbd) |
Date: 2015-12-27 14:33 |
yes I can provide my image the original image was a .png but I converted it to .gif using GIMP alternative download here: image: http://tsfl.nl/mapbg.gif script: http://tsfl.nl/test.py |
|
|
msg257079 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2015-12-27 16:09 |
Arguments for PhotoImage.zoom() are zoom factors, not the dimension of the result. In you case you are trying to create an image with size 54000x29964 pixels. This is over 1.6 gigapixels. Here is pure Tcl equivalent of Python example. It should reproduce the crash. There is a documentation bug in Tkinter. PhotoImage.zoom() docstring is not clear. This can and should be fixed. There is a bug in Tk. It shouldn't crash processing image even if the result has incredible size. But we can't do anything with this bug besides reporting to mainstream. Requalified this issue as easy documentation issue. |
|
|
msg257080 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2015-12-27 16:35 |
Opened Tk ticket: http://core.tcl.tk/tk/info/607ffb053c783490 . |
|
|
msg257319 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2016-01-01 23:52 |
Tk ticket update: '''aspect added on 2015-12-28 00:30:33: I can reproduce this crash on 8.5.18 and 8.6.4, but it appears to be fixed in trunk: "not enough free memory for image buffer".''' We should see fix in 3.6. Doc addition is not exactly trivial, as there is only the barest mention of images in https://docs.python.org/3/library/tkinter.html#images. |
|
|
msg257344 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-01-02 11:22 |
I think it is enough just to update a docstring. Adding comprehensive RST documentation for Tkinter widgets is different issue. |
|
|
msg261570 - (view) |
Author: Varpu Rantala (Varpu Rantala) * |
Date: 2016-03-11 13:43 |
crashes also with Python 3.5.0 (Mac OS X 10.11.3) when x and y are the following or bigger, but works when they are smaller. Tried it with the mapbe.gif image (size 1000 x 681). 30, 27 31, 26 32, 25 33, 24 34, 24 35, 23 36, 22 37, 22 38, 22 39, 21 40, 20 |
|
|
msg261597 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2016-03-11 20:31 |
New changeset 1e7c388dc3c5 by Terry Jan Reedy in branch '2.7': Issue 25959: Explain in docstring that PhotoImage.zoom arguments are https://hg.python.org/cpython/rev/1e7c388dc3c5 New changeset 7474695874d9 by Terry Jan Reedy in branch '3.5': Issue 25959: Explain in docstring that PhotoImage.zoom arguments are https://hg.python.org/cpython/rev/7474695874d9 |
|
|
msg261598 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-03-11 20:41 |
Thanks Terry. |
|
|