Skip to content

Commit 4c0c0bb

Browse files
Petr's notes
1 parent faea092 commit 4c0c0bb

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Lib/test/test_traceback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5064,7 +5064,7 @@ def test_missing_stdlib_module(self):
50645064
code = """
50655065
import sys
50665066
import traceback
5067-
traceback.MISSING_STDLIB_MODULE_MESSAGES = {'spam': "Install 'spam4life' for 'spam'"}
5067+
traceback._MISSING_STDLIB_MODULE_MESSAGES = {'spam': "Install 'spam4life' for 'spam'"}
50685068
sys.stdlib_module_names |= {'spam'}
50695069
import spam
50705070
"""

Lib/traceback.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
from contextlib import suppress
1616

1717
try:
18-
from _missing_stdlib_info import MISSING_STDLIB_MODULE_MESSAGES
18+
from _missing_stdlib_info import _MISSING_STDLIB_MODULE_MESSAGES
1919
except ImportError:
20-
MISSING_STDLIB_MODULE_MESSAGES = {}
20+
_MISSING_STDLIB_MODULE_MESSAGES = {}
2121

2222
__all__ = ['extract_stack', 'extract_tb', 'format_exception',
2323
'format_exception_only', 'format_list', 'format_stack',
@@ -1115,7 +1115,7 @@ def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None,
11151115
elif exc_type and issubclass(exc_type, ModuleNotFoundError):
11161116
module_name = getattr(exc_value, "name", None)
11171117
if module_name in sys.stdlib_module_names:
1118-
message = MISSING_STDLIB_MODULE_MESSAGES.get(
1118+
message = _MISSING_STDLIB_MODULE_MESSAGES.get(
11191119
module_name,
11201120
f"Standard library module {module_name!r} was not found"
11211121
)

Tools/build/check_extension_modules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def generate_missing_stdlib_info(self, config_path: str | None = None) -> None:
302302
with open(config_path, encoding='utf-8') as f:
303303
config_messages = json.load(f)
304304
except (FileNotFoundError, json.JSONDecodeError) as e:
305-
raise RuntimeError("Failed to load missing stdlib config %s: %s", config_path, e)
305+
raise RuntimeError(f"Failed to load missing stdlib config {config_path!r}") from e
306306

307307
messages = {}
308308
for name in WINDOWS_MODULES:
@@ -321,7 +321,7 @@ def generate_missing_stdlib_info(self, config_path: str | None = None) -> None:
321321
# ModuleNotFound error messages.
322322
# Generated by check_extension_modules.py
323323
324-
MISSING_STDLIB_MODULE_MESSAGES = {pprint.pformat(messages)}
324+
_MISSING_STDLIB_MODULE_MESSAGES = {pprint.pformat(messages)}
325325
'''
326326

327327
output_path = self.builddir / "_missing_stdlib_info.py"

0 commit comments

Comments
 (0)