Repository navigation
Fix single-element tuple typos in idlelib and test_email - #161423
PavlNekrasov wants to merge 1 commit into
Conversation
Remove the stray comma in two __repr__ f-strings and append the
('content-shadow', 'Logrus') header instead of discarding it.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Please create an issue. |
|
These are also two unrelated changes so you need two distinct PR. |
|
Yes, 2 PRs. I will handle the IDLE part and someone else the email issue. |
|
@PavlNekrasov I figured out why the IDLE test passed without and with the error. The bad repr method does not affect the purpose of the class, but I will merge the proposed change when separately available. This should actually be 2 issues. While it is true that the stray comma in the email test wraps the 2-tuple in a 1-tuple, the difference in the expression statement is not relevant as the result is not bound and disappears. The important proposed change is appending the 2-tuple to the message. If the test passes without (now) or with (proposed), then something seems amiss. At least in the test. An email person should decide. |
1.
Lib/idlelib/redirector.py— repr shows a spurious tupleThe comma inside the substitution field makes the expression a one-element
tuple, so
repr()returns('WidgetRedirector',)(Text<.text>)instead ofWidgetRedirector(Text<.text>). The same mistake is duplicated inOriginalCommand.__repr__in the same file.cpython/Lib/idlelib/redirector.py
Lines 49 to 51 in 288cc2b
cpython/Lib/idlelib/redirector.py
Lines 145 to 146 in 288cc2b
2.
Lib/test/test_email/test_message.py— header never appendedcpython/Lib/test/test_email/test_message.py
Lines 584 to 585 in 288cc2b
The tuple is created and immediately discarded, so
content-shadownever endsup in
msg_headersand the check that non-standardcontent-*headers (otherthan
Content-Type) are copied to the part in_check_make_multipartneverruns:
cpython/Lib/test/test_email/test_message.py
Lines 616 to 619 in 288cc2b
The mistake masks a real regression: if the condition in
Lib/email/message.pyis narrowed to
Content-Typeonly, the current test set stays green (307 OK),while with the
content-shadowheader properly appended 36 tests fail.Found by Linux Verification Center (linuxtesting.org) with SVACE