summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2010-07-23 11:54:59 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2010-07-23 11:54:59 (GMT)
commite186e384f4fb11158b448d94f37aaf2a3ed6b45e (patch)
tree2781af917151a3c331618f6a62e8866f49aa3f21 /Lib/test
parentc3960c28b0b7c219eb4d5afc2ae32ebb2abb995c (diff)
downloadcpython-e186e384f4fb11158b448d94f37aaf2a3ed6b45e.zip
cpython-e186e384f4fb11158b448d94f37aaf2a3ed6b45e.tar.gz
cpython-e186e384f4fb11158b448d94f37aaf2a3ed6b45e.tar.bz2
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.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_platform.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index ba3af1a..04f1a6a 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -194,6 +194,25 @@ class PlatformTest(unittest.TestCase):
else:
self.assertEquals(res[2], 'PowerPC')
+
+ @unittest.skipUnless(sys.platform == 'darwin', "OSX only test")
+ 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()