import _scproxy import os import sqlite3 # we were calling urllib2, which calls urllib.getproxies, which calls the following function on macosx: print '_scproxy._get_proxies:', _scproxy._get_proxies() # this calls SCDynamicStoreCopyProxies which must call the Grand Central Dispatch libraries # the system sqlite3 links against libdispatch, and it is not fork safe print 'parent pid', os.getpid() # workaround: uncomment the following line # sqlite3.connect(':memory:').close() def do_crash(): print 'child', os.getpid(), 'calling sqlite3. connect' c = sqlite3.connect(':memory:') print 'child sqlite3:', c c.close() pid = os.fork() if pid == 0: do_crash() else: # print 'got from child', r print 'parent forked', pid r = os.waitpid(pid, 0) print 'child exited status:', r[1] print 'WIFEXITED?', os.WIFEXITED(r[1]), 'WIFSIGNALED?', os.WIFSIGNALED(r[1])