mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
parent
03757ec4a5
commit
2f828f2c88
2 changed files with 44 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
from __future__ import with_statement
|
||||
import os
|
||||
import pickle
|
||||
import random
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -137,6 +138,22 @@ class TestPendingCalls(unittest.TestCase):
|
|||
self.pendingcalls_submit(l, n)
|
||||
self.pendingcalls_wait(l, n)
|
||||
|
||||
def test_subinterps(self):
|
||||
# XXX this test leaks in refleak runs
|
||||
import builtins
|
||||
r, w = os.pipe()
|
||||
code = """if 1:
|
||||
import sys, builtins, pickle
|
||||
with open({:d}, "wb") as f:
|
||||
pickle.dump(id(sys.modules), f)
|
||||
pickle.dump(id(builtins), f)
|
||||
""".format(w)
|
||||
with open(r, "rb") as f:
|
||||
ret = _testcapi.run_in_subinterp(code)
|
||||
self.assertEqual(ret, 0)
|
||||
self.assertNotEqual(pickle.load(f), id(sys.modules))
|
||||
self.assertNotEqual(pickle.load(f), id(builtins))
|
||||
|
||||
# Bug #6012
|
||||
class Test6012(unittest.TestCase):
|
||||
def test(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue