bpo-31862: Port binascii to PEP 489 multiphase initialization (GH-4108)
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 8bcbd82..a062a65 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -473,6 +473,19 @@
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):