bpo-31862: Port binascii to PEP 489 multiphase initialization (GH-4108)

This commit is contained in:
Marcel Plch 2019-05-22 13:51:26 +02:00 committed by Petr Viktorin
parent 77aa396bb9
commit 33e71e01e9
3 changed files with 118 additions and 34 deletions

View file

@ -473,6 +473,19 @@ class SubinterpreterTest(unittest.TestCase):
self.assertNotEqual(pickle.load(f), id(sys.modules))
self.assertNotEqual(pickle.load(f), id(builtins))
def test_mutate_exception(self):
"""
Exceptions saved in global module state get shared between
individual module instances. This test checks whether or not
a change in one interpreter's module gets reflected into the
other ones.
"""
import binascii
support.run_in_subinterp("import binascii; binascii.Error.foobar = 'foobar'")
self.assertFalse(hasattr(binascii.Error, "foobar"))
class TestThreadState(unittest.TestCase):