-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-46544: do not leak x
and uspace
in textwrap
#30955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
x
and uspace
in textwrap
x
and uspace
in textwrap
x
and uspace
in textwrap
x
and uspace
in textwrap
Lib/textwrap.py
Outdated
@@ -67,6 +67,7 @@ class TextWrapper: | |||
uspace = ord(' ') | |||
for x in _whitespace: | |||
unicode_whitespace_trans[ord(x)] = uspace | |||
del x, uspace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to replace it with
unicode_whitespace_trans = {ord(x): b' '[0] for x in _whitespace}
or
unicode_whitespace_trans = dict.fromkeys(map(ord, _whitespace), ord(' '))
@@ -0,0 +1,2 @@ | |||
Don't leak ``x`` & ``uspace`` intermediate vars in | |||
:class:`textwrap.TextWrapper`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A news entry for such internal changes seems to have low value for end users!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's useful in the unlikely case someone is relying on these attributes.
https://bugs.python.org/issue46544