New submission from Jared Lang <jsl...@mail.ucf.edu>: Recursion within a thread on OSX can result in a crash by exceeding the systems recursion limit. Recursion behaves as expected if not in thread, meaning it throws a RunTimeError with the message "maximum recursion depth exceeded."
The crash is able to be avoided if the recursion limit is set to a lower number, ie. 800, via sys.setrecursionlimit. Example program which crashes on OSX: >>> def f(): ... return f() ... >>> import threading >>> thread = threading.Thread(target=f) >>> thread.start() Bus error Alternatively, the following works as expected: >>> import sys >>> def f(): ... return f() ... >>> import threading >>> thread = threading.Thread(target=f) >>> sys.setrecursionlimit(800) >>> thread.start() >>> Exception in thread Thread-1: Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner self.run() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 484, in run self.__target(*self.__args, **self.__kwargs) File "<stdin>", line 2, in f File "<stdin>", line 2, in f File "<stdin>", line 2, in f File "<stdin>", line 2, in f File "<stdin>", line 2, in f File "<stdin>", line 2, in f ... RuntimeError: maximum recursion depth exceeded ---------- assignee: ronaldoussoren components: Macintosh messages: 114787 nosy: jaredlang, ronaldoussoren priority: normal severity: normal status: open title: Exceed Recursion Limit in Thread type: crash versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9670> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com