[Python-3000-checkins] r66873 - in python/branches/py3k: Doc/library/os.rst Lib/test/test_array.py Lib/test/test_threading.py

benjamin.peterson python-3000-checkins at python.org
Sat Oct 11 00:20:53 CEST 2008


Author: benjamin.peterson
Date: Sat Oct 11 00:20:52 2008
New Revision: 66873

Log:
Merged revisions 66703,66708 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r66703 | gregory.p.smith | 2008-09-30 15:41:13 -0500 (Tue, 30 Sep 2008) | 6 lines
  
  Works around issue3863: freebsd4/5/6 and os2emx are known to have OS bugs when
  calling fork() from a child thread.  This disables that unit test (with a note
  printed to stderr) on those platforms.
  
  A caveat about buggy platforms is added to the os.fork documentation.
........
  r66708 | andrew.macintyre | 2008-09-30 22:25:25 -0500 (Tue, 30 Sep 2008) | 9 lines
  
  fix for issue 3862: test_array fails FreeBSD 7 amd64
  
  FreeBSD 7's underlying malloc() is behaves differently to earlier versions
  and seriously overcommits available memory on amd64.  This may affect
  other 64bit platforms in some circumstances, so the scale of the 
  problematic test is wound back.
  
  Patch by Mark Dickinson, reviewed by Martin von Loewis.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Doc/library/os.rst
   python/branches/py3k/Lib/test/test_array.py
   python/branches/py3k/Lib/test/test_threading.py

Modified: python/branches/py3k/Doc/library/os.rst
==============================================================================
--- python/branches/py3k/Doc/library/os.rst	(original)
+++ python/branches/py3k/Doc/library/os.rst	Sat Oct 11 00:20:52 2008
@@ -1389,6 +1389,10 @@
 
    Fork a child process.  Return ``0`` in the child and the child's process id in the
    parent.  If an error occurs :exc:`OSError` is raised.
+
+   Note that some platforms including FreeBSD <= 6.3, Cygwin and OS/2 EMX have
+   known issues when using fork() from a thread.
+
    Availability: Unix.
 
 

Modified: python/branches/py3k/Lib/test/test_array.py
==============================================================================
--- python/branches/py3k/Lib/test/test_array.py	(original)
+++ python/branches/py3k/Lib/test/test_array.py	Sat Oct 11 00:20:52 2008
@@ -964,20 +964,21 @@
     minitemsize = 8
 
     def test_alloc_overflow(self):
+        from sys import maxsize
         a = array.array('d', [-1]*65536)
         try:
-            a *= 65536
+            a *= maxsize//65536 + 1
         except MemoryError:
             pass
         else:
-            self.fail("a *= 2**16 didn't raise MemoryError")
+            self.fail("Array of size > maxsize created - MemoryError expected")
         b = array.array('d', [ 2.71828183, 3.14159265, -1])
         try:
-            b * 1431655766
+            b * (maxsize//3 + 1)
         except MemoryError:
             pass
         else:
-            self.fail("a * 1431655766 didn't raise MemoryError")
+            self.fail("Array of size > maxsize created - MemoryError expected")
 
 tests.append(DoubleTest)
 

Modified: python/branches/py3k/Lib/test/test_threading.py
==============================================================================
--- python/branches/py3k/Lib/test/test_threading.py	(original)
+++ python/branches/py3k/Lib/test/test_threading.py	Sat Oct 11 00:20:52 2008
@@ -397,6 +397,12 @@
         import os
         if not hasattr(os, 'fork'):
             return
+        # Skip platforms with known problems forking from a worker thread.
+        # See http://bugs.python.org/issue3863.
+        if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'):
+            print >>sys.stderr, ('Skipping test_3_join_in_forked_from_thread'
+                                 ' due to known OS bugs on'), sys.platform
+            return
         script = """if 1:
             main_thread = threading.current_thread()
             def worker():


More information about the Python-3000-checkins mailing list