mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
bpo-46544: Do not leak x
and uspace
in textwrap.TextWrapper (GH-30955)
This commit is contained in:
parent
08c0ed2d9c
commit
82bce54614
2 changed files with 3 additions and 4 deletions
|
@ -63,10 +63,7 @@ class TextWrapper:
|
||||||
Append to the last line of truncated text.
|
Append to the last line of truncated text.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
unicode_whitespace_trans = {}
|
unicode_whitespace_trans = dict.fromkeys(map(ord, _whitespace), ord(' '))
|
||||||
uspace = ord(' ')
|
|
||||||
for x in _whitespace:
|
|
||||||
unicode_whitespace_trans[ord(x)] = uspace
|
|
||||||
|
|
||||||
# This funky little regex is just the trick for splitting
|
# This funky little regex is just the trick for splitting
|
||||||
# text up into word-wrappable chunks. E.g.
|
# text up into word-wrappable chunks. E.g.
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Don't leak ``x`` & ``uspace`` intermediate vars in
|
||||||
|
:class:`textwrap.TextWrapper`.
|
Loading…
Add table
Add a link
Reference in a new issue