Skip to content

Conversation

@asottile
Copy link
Member

bytes is an alias for str in python2.6+

`bytes` is an alias for `str` in python2.6+
else:
t = six.binary_type
return repr.replace(t("\n"), t("\\n"))
return r.replace(b"\n", b"\\n")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that bytes("string literal") in python3+ is a TypeError so I fixed these as well.

As far as I can tell however this situation is impossible as __repr__ raises for non str types in python3.x

else:
t = six.binary_type
return explanation.replace(t("%"), t("%%"))
return explanation.replace(b"%", b"%%")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one however seems maybe possible? I'm not sure how this code gets called 🤷‍♂️

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 92.637% when pulling 99e31f6 on asottile:bytes_py26_plus into f2e35c8 on pytest-dev:master.

@asottile asottile merged commit 4c14740 into pytest-dev:master Aug 24, 2018
@asottile asottile deleted the bytes_py26_plus branch August 24, 2018 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants