Skip to content
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

BUG: newbytes objects (future.builtins.str objects) are wrongly repred by unidecode #13

Open
hobson opened this issue Aug 23, 2016 · 0 comments

Comments

@hobson
Copy link

hobson commented Aug 23, 2016

Punchline: from builtins import str; str(unidecode(str('2b or not 2b')))

"b'2b or not 2b'"

>>> from unidecode import unidecode
>>> str(unidecode(str('2b or not 2b')))  # no problem
'2b or not 2b'
>>> from builtins import str
>>> str(unidecode(str('2b or not 2b')))  # big problem
"b'2b or not 2b'"
>>> str(str('2b or not 2b'))  # str recursively all you want
'2b or not 2b'
>>> unidecode(str('2b or not 2b'))  # `newbyte` obj is `repr`ed by unidecode
b'2b or not 2b'
>>> unidecode('2b or not 2b')
'2b or not 2b'
>>> unidecode(unidecode('2b or not 2b'))
'2b or not 2b'
>>> unidecode(unidecode(b'2b or not 2b'))
'2b or not 2b'
>>> unidecode(unidecode(str('2b or not 2b')))  # because future.builtins creates a newbytes type
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
...
AttributeError: encode method has been disabled in newbytes
>>> unidecode(str('2b or not 2b'))
b'2b or not 2b'
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

No branches or pull requests

1 participant