bpo-42955: Add sys.modules_names (GH-24238)

Add sys.module_names, containing the list of the standard library
module names.
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
index b4a654f..02077a6 100644
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -334,8 +334,9 @@ def test_disable(self):
     def test_dump_ext_modules(self):
         code = """
             import faulthandler
-            # _testcapi is a test module and not considered as a stdlib module
-            import _testcapi
+            import sys
+            # Don't filter stdlib module names
+            sys.module_names = frozenset()
             faulthandler.enable()
             faulthandler._sigsegv()
             """
@@ -346,7 +347,8 @@ def test_dump_ext_modules(self):
         if not match:
             self.fail(f"Cannot find 'Extension modules:' in {stderr!r}")
         modules = set(match.group(1).strip().split(', '))
-        self.assertIn('_testcapi', modules)
+        for name in ('sys', 'faulthandler'):
+            self.assertIn(name, modules)
 
     def test_is_enabled(self):
         orig_stderr = sys.stderr