homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tkinter goes into an infinite loop (pydoc.gui)
Type: crash Stage:
Components: Extension Modules, Tkinter Versions: Python 3.3
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: HWJ, asvetlov, gpolo, loewis, python-dev
Priority: normal Keywords: patch

Created on 2008年09月11日 13:20 by HWJ, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue_3835.diff gpolo, 2008年09月17日 13:08 review
issue_3835_2.diff asvetlov, 2012年03月13日 18:15 review
Messages (15)
msg73021 - (view) Author: Helmut Jarausch (HWJ) Date: 2008年09月11日 13:20
With version 3.0 (SVN 66386)
import pydoc
pydoc.gui()
gives
>>> Exception in thread Thread-1:
Traceback (most recent call last):
 File "/usr/local/lib/python3.0/threading.py", line 507, in 
_bootstrap_inner
 self.run()
 File "/usr/local/lib/python3.0/threading.py", line 462, in run
 self._target(*self._args, **self._kwargs)
 File "/usr/local/lib/python3.0/pydoc.py", line 1989, in serve
 DocServer(port, callback).serve_until_quit()
 File "/usr/local/lib/python3.0/pydoc.py", line 1971, in __init__
 self.base.__init__(self, self.address, self.handler)
 File "/usr/local/lib/python3.0/socketserver.py", line 401, in __init__
 self.server_activate()
 File "/usr/local/lib/python3.0/pydoc.py", line 1982, in 
server_activate
 if self.callback: self.callback(self)
 File "/usr/local/lib/python3.0/pydoc.py", line 2072, in ready
 text='Python documentation server at\n' + server.url)
 File "/usr/local/lib/python3.0/tkinter/__init__.py", line 1199, in 
configure
 return self._configure('configure', cnf, kw)
 File "/usr/local/lib/python3.0/tkinter/__init__.py", line 1190, in 
_configure
 self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: out of stack space (infinite loop?)
msg73237 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008年09月14日 21:33
What tcl/tk version are you using ?
Also, can you put a "print(_flatten((self._w, cmd)) +
self._options(cnf))" before the line 1190 in
/usr/local/lib/python3.0/tkinter/__init__.py and tell what it shows when
you call pydoc.gui ?
msg73259 - (view) Author: Helmut Jarausch (HWJ) Date: 2008年09月15日 12:50
I'm using Tcl/Tk 8.5.4 here
 print(":::")
 print(_flatten((self._w, cmd)) + self._options(cnf))
produces:
:::
('.3073836300', 'configure', '-yscrollcommand', '3077632332set')
:::
('.3073835564.3073835660', 'configure', '-text', 'Python documentation 
server at\nhttp://localhost:7464/')
>>> Exception in thread Thread-1:
Traceback (most recent call last):
 File "/usr/local/lib/python3.0/threading.py", line 507, in 
_bootstrap_inner
 self.run()
 File "/usr/local/lib/python3.0/threading.py", line 462, in run
 self._target(*self._args, **self._kwargs)
 File "/usr/local/lib/python3.0/pydoc.py", line 1989, in serve
 DocServer(port, callback).serve_until_quit()
 File "/usr/local/lib/python3.0/pydoc.py", line 1971, in __init__
 self.base.__init__(self, self.address, self.handler)
 File "/usr/local/lib/python3.0/socketserver.py", line 401, in __init__
 self.server_activate()
 File "/usr/local/lib/python3.0/pydoc.py", line 1982, in 
server_activate
 if self.callback: self.callback(self)
 File "/usr/local/lib/python3.0/pydoc.py", line 2072, in ready
 text='Python documentation server at\n' + server.url)
 File "/usr/local/lib/python3.0/tkinter/__init__.py", line 1201, in 
configure
 return self._configure('configure', cnf, kw)
 File "/usr/local/lib/python3.0/tkinter/__init__.py", line 1192, in 
_configure
 self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: out of stack space (infinite loop?)
msg73265 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008年09月15日 15:29
Uhm, is it caused only by the combination of tk 8.5.4 and py3k, or does
the same happen with tk 8.5.4 and python-trunk ? What about tk 8.5.3 (or
some other of tk 8.5 series) or even tk 8.4.16 and {python-trunk, py3k} ? 
It would be good if you could test some other combination, specially
because I can't reproduce it here with other versions (but I'm compiling
8.5.4 here now).
msg73302 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008年09月16日 15:18
Just reproduced the issue under python-trunk with tcl/tk 8.5.4 and 8.5.3
msg73303 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008年09月16日 15:41
But it happens only if you don't build tcl/tk with --enable-threads =)
msg73304 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008年09月16日 17:00
If you remove the widget.config calls in GUI.ready you will notice the
problem "goes away", but note that this method is called from another
thread while you have a non-thread-safe tcl/tk lib (I'm assuming you
didn't compile it with --enable-threads). So.. using multiple threads in
Python while Tcl is compiled without --enable-threads isn't supported at
all.
To reproduce the problem try this (change Tkinter to tkinter if py3k):
import threading
import Tkinter
lbl = Tkinter.Label(text="hi")
threading.Thread(target=lambda: lbl.configure(text="hi there")).start()
lbl.mainloop()
If your tcl/tk libs weren't compiled with --enable-threads this should
get you an "TclError: out of stack space (infinite loop?)". A
documentation note may be added somewhere, but nothing much else is
going to happen (that is what I believe at least).
msg73324 - (view) Author: Helmut Jarausch (HWJ) Date: 2008年09月17日 08:07
Many thanks, that solved the problem.
Since the cause of the problem wasn't easy to find out
(for me, at least)
would be possible to check at import time if Tcl/Tk has been
configured with threads enabled?
Helmut.
msg73332 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008年09月17日 13:08
The patch attached checks for that when an interpreter is created, not
really at import time but should be enough.
But my real concern is that tkinter thinks it will work properly when
Python is using threads and Tcl wasn't compiled with --enable-threads.
Maybe that was true some time ago or maybe in other platforms, but isn't
the case anymore.
msg155640 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012年03月13日 18:15
Push updated patch for tip (3.3) head
msg155664 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年03月13日 20:59
New changeset d731dcda2611 by Martin v. Löwis in branch 'default':
Issue #3835: Refuse to use unthreaded Tcl in threaded Python.
http://hg.python.org/cpython/rev/d731dcda2611 
msg155665 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012年03月13日 21:00
Thanks for the patch!
msg155763 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年03月14日 16:40
New changeset 7cbc48324938 by Andrew Svetlov in branch 'default':
Revert the patch for issue 3835 because failed on Windows buildbot
http://hg.python.org/cpython/rev/7cbc48324938 
msg155764 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012年03月14日 16:43
Recall to 'open' state
msg155765 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012年03月14日 16:50
Close as 'not a bug' because Guilherme's test to reproduce the bug from msg73304 works good at least for Linux. 
Windows version of Tcl/Tk compiled without threading support.
So current behavior is correct and should not to be fixed.
History
Date User Action Args
2022年04月11日 14:56:39adminsetgithub: 48085
2012年03月14日 16:50:16asvetlovsetstatus: open -> closed
resolution: rejected
messages: + msg155765
2012年03月14日 16:43:09asvetlovsetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg155764
2012年03月14日 16:40:18python-devsetmessages: + msg155763
2012年03月13日 21:00:09loewissetstatus: open -> closed

nosy: + loewis
messages: + msg155665

resolution: fixed
2012年03月13日 20:59:23python-devsetnosy: + python-dev
messages: + msg155664
2012年03月13日 18:15:54asvetlovsetfiles: + issue_3835_2.diff
nosy: + asvetlov
messages: + msg155640

2011年02月04日 00:08:25eric.araujosetnosy: gpolo, HWJ
components: + Tkinter
versions: + Python 3.3, - Python 3.0
2008年09月17日 13:10:11gpolosetpriority: normal
2008年09月17日 13:08:48gpolosetfiles: + issue_3835.diff
keywords: + patch
messages: + msg73332
2008年09月17日 08:07:43HWJsetmessages: + msg73324
2008年09月16日 17:00:02gpolosetmessages: + msg73304
2008年09月16日 15:41:20gpolosetmessages: + msg73303
2008年09月16日 15:18:44gpolosetmessages: + msg73302
2008年09月15日 15:29:26gpolosetmessages: + msg73265
2008年09月15日 12:50:48HWJsetmessages: + msg73259
2008年09月14日 21:33:52gpolosetnosy: + gpolo
messages: + msg73237
2008年09月11日 13:20:28HWJcreate

AltStyle によって変換されたページ (->オリジナル) /