Branch merge
diff --git a/.hgtags b/.hgtags
index 91ded74..df70524 100644
--- a/.hgtags
+++ b/.hgtags
@@ -112,6 +112,8 @@
657f16582943739b906f66f7efad4014492c8b1c v2.5.5c1
1dc91e9dd5c13a4bc2d3bb7d4b5896ab264f2325 v2.5.5c2
7098a46f0b75e5aacfaf81d65d72e3613b023532 v2.5.5
+a87c7b96672b69dffef64c59b56fba5bb2059b99 v2.5.6c1
+de34c7b097e8d66b1140c211dbd61d48b31ba483 v2.5.6
2d0bd095c420b0711000d9be66848f6cfd972b3b v2.6a1
eec144917a189be11ed5efa35c6604d03bc62bcc v2.6a2
48e9fb0a721799877f26edaef01ac6e6029b6812 v2.6a3
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 0062634..946c1d2 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -689,6 +689,37 @@
class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests):
semtype = staticmethod(threading.BoundedSemaphore)
+ @unittest.skipUnless(sys.platform == 'darwin', 'test macosx problem')
+ def test_recursion_limit(self):
+ # Issue 9670
+ # test that excessive recursion within a non-main thread causes
+ # an exception rather than crashing the interpreter on platforms
+ # like Mac OS X or FreeBSD which have small default stack sizes
+ # for threads
+ script = """if True:
+ import threading
+
+ def recurse():
+ return recurse()
+
+ def outer():
+ try:
+ recurse()
+ except RuntimeError:
+ pass
+
+ w = threading.Thread(target=outer)
+ w.start()
+ w.join()
+ print('end of main thread')
+ """
+ expected_output = "end of main thread\n"
+ p = subprocess.Popen([sys.executable, "-c", script],
+ stdout=subprocess.PIPE)
+ stdout, stderr = p.communicate()
+ data = stdout.decode().replace('\r', '')
+ self.assertEqual(p.returncode, 0, "Unexpected error")
+ self.assertEqual(data, expected_output)
def test_main():
test.test_support.run_unittest(LockTests, RLockTests, EventTests,
diff --git a/Mac/Makefile.in b/Mac/Makefile.in
index 5ab0ae5..0e4e070 100644
--- a/Mac/Makefile.in
+++ b/Mac/Makefile.in
@@ -77,6 +77,13 @@
do \
ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
done
+ifneq ($(LIPO_32BIT_FLAGS),)
+ for fn in python-32 pythonw-32 \
+ python$(VERSION)-32 pythonw$(VERSION)-32 ;\
+ do \
+ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
+ done
+endif
#
@@ -91,6 +98,12 @@
do \
ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
done
+ifneq ($(LIPO_32BIT_FLAGS),)
+ for fn in python$(VERSION)-32 pythonw$(VERSION)-32 ;\
+ do \
+ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
+ done
+endif
ln -fs "$(prefix)/bin/2to3-$(VERSION)" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/2to3-$(VERSION)" ;\
# By default most tools are installed without a version in their basename, to
diff --git a/Makefile.pre.in b/Makefile.pre.in
index fbd54c7..ed0d116 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -854,7 +854,7 @@
PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
LIBSUBDIRS= lib-tk lib-tk/test lib-tk/test/test_tkinter \
lib-tk/test/test_ttk site-packages test test/data \
- test/cjkencodings test/decimaltestdata test/xmltestdata \
+ test/cjkencodings test/decimaltestdata test/xmltestdata test/subprocessdata \
test/tracedmodules \
encodings compiler hotshot \
email email/mime email/test email/test/data \
diff --git a/Misc/NEWS b/Misc/NEWS
index ae2b5fa..4540d5f 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -9,6 +9,11 @@
Core and Builtins
-----------------
+- Issue #9670: Increase the default stack size for secondary threads on
+ Mac OS X and FreeBSD to reduce the chances of a crash instead of a
+ "maximum recursion depth" RuntimeError exception.
+ (patch by Ronald Oussoren)
+
- Correct lookup of __dir__ on objects. Among other things, this causes errors
besides AttributeError found on lookup to be propagated.
@@ -432,6 +437,10 @@
Build
-----
+- Issue #11217: For 64-bit/32-bit Mac OS X universal framework builds,
+ ensure "make install" creates symlinks in --prefix bin for the "-32"
+ files in the framework bin directory like the installer does.
+
- Issue #11411: Fix 'make DESTDIR=' with a relative destination.
- Issue #10709: Add updated AIX notes in Misc/README.AIX.
@@ -479,6 +488,8 @@
Tests
-----
+- Issue #12205: Fix test_subprocess failure due to uninstalled test data.
+
- Issue #5723: Improve json tests to be executed with and without accelerations.
- Issue #11910: Fix test_heapq to skip the C tests when _heapq is missing.
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index ef49a30..44e2552 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -18,6 +18,18 @@
#ifndef THREAD_STACK_SIZE
#define THREAD_STACK_SIZE 0 /* use default stack size */
#endif
+
+#if (defined(__APPLE__) || defined(__FreeBSD__)) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
+ /* The default stack size for new threads on OSX is small enough that
+ * we'll get hard crashes instead of 'maximum recursion depth exceeded'
+ * exceptions.
+ *
+ * The default stack size below is the minimal stack size where a
+ * simple recursive function doesn't cause a hard crash.
+ */
+#undef THREAD_STACK_SIZE
+#define THREAD_STACK_SIZE 0x400000
+#endif
/* for safety, ensure a viable minimum stacksize */
#define THREAD_STACK_MIN 0x8000 /* 32kB */
#else /* !_POSIX_THREAD_ATTR_STACKSIZE */