Skip to content

Commit 2604e33

Browse files
committed
Issue9670: Merge backout to 3.2.
2 parents 15012a6 + 45e47e5 commit 2604e33

File tree

3 files changed

+0
-47
lines changed

3 files changed

+0
-47
lines changed

Lib/test/test_threading.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -677,36 +677,6 @@ def test_daemonize_active_thread(self):
677677
thread.start()
678678
self.assertRaises(RuntimeError, setattr, thread, "daemon", True)
679679

680-
def test_recursion_limit(self):
681-
# Issue 9670
682-
# test that excessive recursion within a non-main thread causes
683-
# an exception rather than crashing the interpreter on platforms
684-
# like Mac OS X or FreeBSD which have small default stack sizes
685-
# for threads
686-
script = """if True:
687-
import threading
688-
689-
def recurse():
690-
return recurse()
691-
692-
def outer():
693-
try:
694-
recurse()
695-
except RuntimeError:
696-
pass
697-
698-
w = threading.Thread(target=outer)
699-
w.start()
700-
w.join()
701-
print('end of main thread')
702-
"""
703-
expected_output = "end of main thread\n"
704-
p = subprocess.Popen([sys.executable, "-c", script],
705-
stdout=subprocess.PIPE)
706-
stdout, stderr = p.communicate()
707-
data = stdout.decode().replace('\r', '')
708-
self.assertEqual(p.returncode, 0, "Unexpected error")
709-
self.assertEqual(data, expected_output)
710680

711681
class LockTests(lock_tests.LockTests):
712682
locktype = staticmethod(threading.Lock)

Misc/NEWS

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ What's New in Python 3.2.1?
1010
Core and Builtins
1111
-----------------
1212

13-
- Issue #9670: Increase the default stack size for secondary threads on
14-
Mac OS X and FreeBSD to reduce the chances of a crash instead of a
15-
"maximum recursion depth" RuntimeError exception.
16-
(original patch by Ronald Oussoren)
17-
1813
- Issue #11650: PyOS_StdioReadline() retries fgets() if it was interrupted
1914
(EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch
2015
written by Charles-Francois Natali.

Python/thread_pthread.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,6 @@
1818
#ifndef THREAD_STACK_SIZE
1919
#define THREAD_STACK_SIZE 0 /* use default stack size */
2020
#endif
21-
22-
#if (defined(__APPLE__) || defined(__FreeBSD__)) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
23-
/* The default stack size for new threads on OSX is small enough that
24-
* we'll get hard crashes instead of 'maximum recursion depth exceeded'
25-
* exceptions.
26-
*
27-
* The default stack size below is the minimal stack size where a
28-
* simple recursive function doesn't cause a hard crash.
29-
*/
30-
#undef THREAD_STACK_SIZE
31-
#define THREAD_STACK_SIZE 0x100000
32-
#endif
3321
/* for safety, ensure a viable minimum stacksize */
3422
#define THREAD_STACK_MIN 0x8000 /* 32kB */
3523
#else /* !_POSIX_THREAD_ATTR_STACKSIZE */

0 commit comments

Comments
 (0)