summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_warnings/__init__.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py
index 69623c4..75539cf 100644
--- a/Lib/test/test_warnings/__init__.py
+++ b/Lib/test/test_warnings/__init__.py
@@ -794,6 +794,17 @@ class _WarningsTests(BaseTest, unittest.TestCase):
self.assertNotIn(b'Warning!', stderr)
self.assertNotIn(b'Error', stderr)
+ @support.cpython_only
+ def test_issue31411(self):
+ # warn_explicit() shouldn't raise a SystemError in case
+ # warnings.onceregistry isn't a dictionary.
+ wmod = self.module
+ with original_warnings.catch_warnings(module=wmod):
+ wmod.filterwarnings('once')
+ with support.swap_attr(wmod, 'onceregistry', None):
+ with self.assertRaises(TypeError):
+ wmod.warn_explicit('foo', Warning, 'bar', 1, registry=None)
+
class WarningsDisplayTests(BaseTest):