Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bcd8ac3

Browse files
committed
Merged revisions 66703,66708 via svnmerge from
svn+ssh://[email protected]/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. ........
1 parent cf8016a commit bcd8ac3

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

Doc/library/os.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,10 @@ written in Python, such as a mail server's external command delivery program.
13891389

13901390
Fork a child process. Return ``0`` in the child and the child's process id in the
13911391
parent. If an error occurs :exc:`OSError` is raised.
1392+
1393+
Note that some platforms including FreeBSD <= 6.3, Cygwin and OS/2 EMX have
1394+
known issues when using fork() from a thread.
1395+
13921396
Availability: Unix.
13931397

13941398

Lib/test/test_array.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -964,20 +964,21 @@ class DoubleTest(FPTest):
964964
minitemsize = 8
965965

966966
def test_alloc_overflow(self):
967+
from sys import maxsize
967968
a = array.array('d', [-1]*65536)
968969
try:
969-
a *= 65536
970+
a *= maxsize//65536 + 1
970971
except MemoryError:
971972
pass
972973
else:
973-
self.fail("a *= 2**16 didn't raise MemoryError")
974+
self.fail("Array of size > maxsize created - MemoryError expected")
974975
b = array.array('d', [ 2.71828183, 3.14159265, -1])
975976
try:
976-
b * 1431655766
977+
b * (maxsize//3 + 1)
977978
except MemoryError:
978979
pass
979980
else:
980-
self.fail("a * 1431655766 didn't raise MemoryError")
981+
self.fail("Array of size > maxsize created - MemoryError expected")
981982

982983
tests.append(DoubleTest)
983984

Lib/test/test_threading.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,12 @@ def test_3_join_in_forked_from_thread(self):
397397
import os
398398
if not hasattr(os, 'fork'):
399399
return
400+
# Skip platforms with known problems forking from a worker thread.
401+
# See http://bugs.python.org/issue3863.
402+
if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'):
403+
print >>sys.stderr, ('Skipping test_3_join_in_forked_from_thread'
404+
' due to known OS bugs on'), sys.platform
405+
return
400406
script = """if 1:
401407
main_thread = threading.current_thread()
402408
def worker():

0 commit comments

Comments
 (0)