import time
import unittest
import weakref
+import os
+from test.script_helper import assert_python_ok, assert_python_failure
+ import subprocess
from test import lock_tests
thread.start()
self.assertRaises(RuntimeError, setattr, thread, "daemon", True)
-
-class LockTests(lock_tests.LockTests):
- locktype = staticmethod(threading.Lock)
-
-class RLockTests(lock_tests.RLockTests):
- locktype = staticmethod(threading.RLock)
-
-class EventTests(lock_tests.EventTests):
- eventtype = staticmethod(threading.Event)
-
-class ConditionAsRLockTests(lock_tests.RLockTests):
- # An Condition uses an RLock by default and exports its API.
- locktype = staticmethod(threading.Condition)
-
-class ConditionTests(lock_tests.ConditionTests):
- condtype = staticmethod(threading.Condition)
-
-class SemaphoreTests(lock_tests.SemaphoreTests):
- semtype = staticmethod(threading.Semaphore)
-
-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)
+class LockTests(lock_tests.LockTests):
+ locktype = staticmethod(threading.Lock)
+
+class PyRLockTests(lock_tests.RLockTests):
+ locktype = staticmethod(threading._PyRLock)
+
+class CRLockTests(lock_tests.RLockTests):
+ locktype = staticmethod(threading._CRLock)
+
+class EventTests(lock_tests.EventTests):
+ eventtype = staticmethod(threading.Event)
+
+class ConditionAsRLockTests(lock_tests.RLockTests):
+ # An Condition uses an RLock by default and exports its API.
+ locktype = staticmethod(threading.Condition)
+
+class ConditionTests(lock_tests.ConditionTests):
+ condtype = staticmethod(threading.Condition)
+
+class SemaphoreTests(lock_tests.SemaphoreTests):
+ semtype = staticmethod(threading.Semaphore)
+
+class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests):
+ semtype = staticmethod(threading.BoundedSemaphore)
+
+class BarrierTests(lock_tests.BarrierTests):
+ barriertype = staticmethod(threading.Barrier)
+
def test_main():
- test.support.run_unittest(LockTests, RLockTests, EventTests,
+ test.support.run_unittest(LockTests, PyRLockTests, CRLockTests, EventTests,
ConditionAsRLockTests, ConditionTests,
SemaphoreTests, BoundedSemaphoreTests,
ThreadTests,
Core and Builtins
-----------------
-- Correct lookup of __dir__ on objects. Among other things, this causes errors
- besides AttributeError found on lookup to be propagated.
-
-- Issue #12060: Use sig_atomic_t type and volatile keyword in the signal
- module. Patch written by Charles-François Natali.
+ - 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)
+
+Library
+-------
-- Issue #1195: Fix input() if it is interrupted by CTRL+d and then CTRL+c,
- clear the end-of-file indicator after CTRL+d.
+- Issue #12175: RawIOBase.readall() now returns None if read() returns None.
-- Issue #9756: When calling a method descriptor or a slot wrapper descriptor,
- the check of the object type doesn't read the __class__ attribute anymore.
- Fix a crash if a class override its __class__ attribute (e.g. a proxy of the
- str type). Patch written by Andreas Stührk.
+- Issue #12175: FileIO.readall() now raises a ValueError instead of an IOError
+ if the file is closed.
-- Issue #6780: fix starts/endswith error message to mention that tuples are
- accepted too.
+- Issue #12070: Fix the Makefile parser of the sysconfig module to handle
+ correctly references to "bogus variable" (e.g. "prefix=$/opt/python").
-- Issue #5057: fix a bug in the peepholer that led to non-portable pyc files
- between narrow and wide builds while optimizing BINARY_SUBSCR on non-BMP
- chars (e.g. "\U00012345"[0]).
+- Issue #12100: Don't reset incremental encoders of CJK codecs at each call to
+ their encode() method anymore, but continue to call the reset() method if the
+ final argument is True.
-- Issue #11650: PyOS_StdioReadline() retries fgets() if it was interrupted
- (EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch
- written by Charles-Francois Natali.
+- Issue #5715: In socketserver, close the server socket in the child process.
-- Issue #8651: PyArg_Parse*() functions raise an OverflowError if the file
- doesn't have PY_SSIZE_T_CLEAN define and the size doesn't fit in an int
- (length bigger than 2^31-1 bytes).
+- Correct lookup of __dir__ on objects. Among other things, this causes errors
+ besides AttributeError found on lookup to be propagated.
-- Issue #11450: Don't truncate hg version info in Py_GetBuildInfo() when
- there are many tags (e.g. when using mq). Patch by Nadeem Vawda.
+- Issue #12124: zipimport doesn't keep a reference to zlib.decompress() anymore
+ to be able to unload the module.
-- Issue #10451: memoryview objects could allow to mutate a readable buffer.
- Initial patch by Ross Lagerwall.
+- Issue #12065: connect_ex() on an SSL socket now returns the original errno
+ when the socket's timeout expires (it used to return None).
-- Issue #10892: Don't segfault when trying to delete __abstractmethods__ from a
- class.
-- Issue #8020: Avoid a crash where the small objects allocator would read
- non-Python managed memory while it is being modified by another thread.
- Patch by Matt Bandy.
-- Issue #8278: On Windows and with a NTFS filesystem, os.stat() and os.utime()
- can now handle dates after 2038.
+What's New in Python 3.2.1 release candidate 1?
+===============================================
-- issue #11828: startswith and endswith don't accept None as slice index.
- Patch by Torsten Becker.
+*Release date: 15-May-2011*
-- Issue #4236: PyModule_Create2 now checks the import machinery directly
- rather than the Py_IsInitialized flag, avoiding a Fatal Python
- error in certain circumstances when an import is done in __del__.
+Core and Builtins
+-----------------
-- Issue #10596: Fix float.__mod__ to have the same behaviour as
- float.__divmod__ with respect to signed zeros. -4.0 % 4.0 should be
- 0.0, not -0.0.
+- Issue #12060: Use sig_atomic_t type and volatile keyword in the signal
+ module. Patch written by Charles-François Natali.
-- Issue #5587: add a repr to dict_proxy objects. Patch by David Stanek and
- Daniel Urban.
+- Issue #12044: Fixed subprocess.Popen when used as a context manager to
+ wait for the process to end when exiting the context to avoid unintentionally
+ leaving zombie processes around.
-- Issue #11506: Trying to assign to a bytes literal should result in a
- SyntaxError.
+- Issue #1195: Fix input() if it is interrupted by CTRL+d and then CTRL+c,
+ clear the end-of-file indicator after CTRL+d.
Library
-------