Skip to content

Comments

Atom http-core handle bytes strings.#1

Open
jankoprowski wants to merge 1 commit intohfalcic:masterfrom
jankoprowski:master
Open

Atom http-core handle bytes strings.#1
jankoprowski wants to merge 1 commit intohfalcic:masterfrom
jankoprowski:master

Conversation

@jankoprowski
Copy link

If instance of 'bytes' variable is detected data are decoded using
'utf-8' by default and treated as the string.

If instance of 'bytes' variable is detected data are decoded using
'utf-8' by default and treated as the string.
@hfalcic
Copy link
Owner

hfalcic commented Dec 11, 2014

I'm a bit unsure of the motivation behind this. Most internal data processing in a Python 3 application should be text except in very specialized cases. In addition, It's generally not a good idea to design APIs that take both binary data and text and try to do the right thing with both inputs, as mentioned in https://docs.python.org/3/howto/pyporting.html#text-versus-binary-data.

Is there a specific exception that you fixed with this change? I use this fork of gdata to upload videos to YouTube (successfully) and do not want the video data decoded as text or anything along those lines.

@jankoprowski
Copy link
Author

I've just fixed exception during existing user's password change:

raise UnknownSize('Each part of the body must have a known size.')

from line 124 was raised. This fix translate binary to string because method expects strings and for some reason does it get it under Python 3. I saw similar fixes in other parts of the code so I thought it will be good idea.

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