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
BytesWarnings triggerred by test suite #64562
Comments
[194/388] test_base64 |
I think that repr could be used: Any opinions? |
|
You rather meant [2:-1] instead of [1:-1], but if initial "b'" and final "'" are not needed in result string, then maybe just call .decode() on an instance of bytes. >>> str(b"xxx")
"b'xxx'"
>>> repr(b"xxx")
"b'xxx'"
>>> repr(b"xxx")[1:-1]
"'xxx"
>>> repr(b"xxx")[2:-1]
'xxx'
>>> b"xxx".decode()
'xxx' |
Agree. "{}".format(bytestr) -> "{!r}".format(bytestr) |
Here's a patch to silence BytesWarnings. |
I think that %s is better for 'dashes' variable (which is always str) in Lib/distutils/command/register.py: |
And
can be simplified to
|
Thanks for the review, Arfrever and Serhiy. Here's a new patch. |
The new patch has %s and %r reversed in Lib/distutils/command/register.py. |
Ah, my bad. Thanks Arfrever. |
LGTM. |
New changeset 791674a74e47 by Serhiy Storchaka in branch '3.3': New changeset a4431dce107a by Serhiy Storchaka in branch 'default': |
Thank you Arfrever for your report. Thank you Berker for your patch. |
Thanks for applying the patch. distutils tests don’t cover 100% of the codebase; did you test manually that the behavior of the changed code was still correct? |
At least it wasn't changed. As I see, affected line is used to output debugging message (disabled by default). It produces different result in 2.7 and 3.x ("----------xxx----------" vs "----------b'xxx'----------") due to the difference between 2.x str and 3.x bytes. |
I don’t understand one thing: you said the output wasn’t changed, then show an example of changed output: “"----------xxx----------" vs "----------b'xxx'----------"”. The “data” that is displayed is supposed to be text; showing “b'” and “'” is a regression for the 3.x line. |
Output is different between Python 2 and 3, but not different between different versions in Python 3. |
Thanks for correcting me. I created bpo-20900. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: