diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2022-01-27 11:55:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 11:55:58 (GMT) |
commit | 82bce54614f8116a40454fbbbf96a3fd460ca7df (patch) | |
tree | 0cc6b3cb4932f5400a88dea97692103c5b494f2e /Lib/textwrap.py | |
parent | 08c0ed2d9c0d01ad1a5adc0787bc75e4e90cbb85 (diff) | |
download | cpython-82bce54614f8116a40454fbbbf96a3fd460ca7df.zip cpython-82bce54614f8116a40454fbbbf96a3fd460ca7df.tar.gz cpython-82bce54614f8116a40454fbbbf96a3fd460ca7df.tar.bz2 |
bpo-46544: Do not leak `x` and `uspace` in textwrap.TextWrapper (GH-30955)
Diffstat (limited to 'Lib/textwrap.py')
-rw-r--r-- | Lib/textwrap.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/textwrap.py b/Lib/textwrap.py index 841de9b..98bedd2 100644 --- a/Lib/textwrap.py +++ b/Lib/textwrap.py @@ -63,10 +63,7 @@ class TextWrapper: Append to the last line of truncated text. """ - unicode_whitespace_trans = {} - uspace = ord(' ') - for x in _whitespace: - unicode_whitespace_trans[ord(x)] = uspace + unicode_whitespace_trans = dict.fromkeys(map(ord, _whitespace), ord(' ')) # This funky little regex is just the trick for splitting # text up into word-wrappable chunks. E.g. |