Skip to content

Commit c17a0b8

Browse files
committed
Issue #26809: Add __all__ to string module. Patch by Emanuel Barry
1 parent 78b642c commit c17a0b8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Lib/string.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
1515
"""
1616

17+
__all__ = ["ascii_letters", "ascii_lowercase", "ascii_uppercase", "capwords",
18+
"digits", "hexdigits", "octdigits", "printable", "punctuation",
19+
"whitespace", "Formatter", "Template"]
20+
1721
import _string
1822

1923
# Some strings for ctype-style character classification
@@ -46,7 +50,7 @@ def capwords(s, sep=None):
4650

4751
####################################################################
4852
import re as _re
49-
from collections import ChainMap
53+
from collections import ChainMap as _ChainMap
5054

5155
class _TemplateMetaclass(type):
5256
pattern = r"""
@@ -104,7 +108,7 @@ def substitute(*args, **kws):
104108
if not args:
105109
mapping = kws
106110
elif kws:
107-
mapping = ChainMap(kws, args[0])
111+
mapping = _ChainMap(kws, args[0])
108112
else:
109113
mapping = args[0]
110114
# Helper function for .sub()
@@ -134,7 +138,7 @@ def safe_substitute(*args, **kws):
134138
if not args:
135139
mapping = kws
136140
elif kws:
137-
mapping = ChainMap(kws, args[0])
141+
mapping = _ChainMap(kws, args[0])
138142
else:
139143
mapping = args[0]
140144
# Helper function for .sub()

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ Core and Builtins
131131
Library
132132
-------
133133

134+
- Issue #26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry.
135+
134136
- Issue #26373: subprocess.Popen.communicate now correctly ignores
135137
BrokenPipeError when the child process dies before .communicate()
136138
is called in more/all circumstances.

0 commit comments

Comments
 (0)