mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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:
parent
c3960c28b0
commit
e186e384f4
3 changed files with 71 additions and 11 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue