Merged revisions 83085 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/release27-maint

................
  r83085 | ronald.oussoren | 2010-07-23 13:41:00 +0100 (Fri, 23 Jul 2010) | 12 lines

  Merged revisions 83075 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/branches/py3k

  ........
    r83075 | ronald.oussoren | 2010-07-23 12:54:59 +0100 (Fri, 23 Jul 2010) | 5 lines

    Fix for issue 7895. Avoid crashing the interpreter
    when calling platform.mac_ver after calling os.fork by
    reading from a system configuration file instead of
    using OSX APIs.
  ........
................
This commit is contained in:
Ronald Oussoren 2010-07-23 12:45:53 +00:00
parent ef8204e713
commit 446aa638d5
3 changed files with 71 additions and 11 deletions

View file

@ -120,6 +120,25 @@ class PlatformTest(unittest.TestCase):
else:
self.assertEquals(res[2], 'PowerPC')
if sys.platform == 'darwin':
def test_mac_ver_with_fork(self):
# Issue7895: platform.mac_ver() crashes when using fork without exec
#
# This test checks that the fix for that issue works.
#
pid = os.fork()
if pid == 0:
# child
info = platform.mac_ver()
os._exit(0)
else:
# parent
cpid, sts = os.waitpid(pid, 0)
self.assertEquals(cpid, pid)
self.assertEquals(sts, 0)
def test_dist(self):
res = platform.dist()