Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_platform.py @ 63148:e60fdb348bdc
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.
| author | Ronald Oussoren <ronaldoussoren@mac.com> |
|---|---|
| date | Fri, 23 Jul 2010 11:54:59 +0000 |
| parents | e97cdd5c5e4f |
| children | 9fe76c26ea9f |
line wrap: on
line diff
--- a/Lib/test/test_platform.py Fri Jul 23 11:48:36 2010 +0000 +++ b/Lib/test/test_platform.py Fri Jul 23 11:54:59 2010 +0000 @@ -194,6 +194,25 @@ 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()
