We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d2d9246 commit 94ff629Copy full SHA for 94ff629
Lib/test/test_capi/test_import.py
@@ -327,6 +327,18 @@ def test_getmoduleattr(self):
327
getmoduleattr = _testcapi.PyImport_GetModuleAttr
328
self.check_getmoduleattr(getmoduleattr)
329
330
+ # Invalid module name type
331
+ for mod_name in (object(), 123, b'bytes'):
332
+ with self.subTest(mod_name=mod_name):
333
+ with self.assertRaises(TypeError):
334
+ getmoduleattr(mod_name, "attr")
335
+
336
+ # Invalid attribute name type
337
+ for attr_name in (object(), 123, b'bytes'):
338
+ with self.subTest(attr_name=attr_name):
339
340
+ getmoduleattr("sys", attr_name)
341
342
with self.assertRaises(SystemError):
343
getmoduleattr(NULL, "argv")
344
# CRASHES getmoduleattr("sys", NULL)
0 commit comments