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
base64.encodestring does not actually accept strings #47863
Comments
This quote from base64.py: --- bytes_types = (bytes, bytearray) # Types acceptable as binary data
...
def encodestring(s):
"""Encode a string into multiple lines of base-64 data.
--- shows that encodestring method won't accept str for an argument, only Anyway, this behavior clashes in (the least I know) xmlrpc.client, line --- auth = base64.encodestring(urllib.parse.unquote(auth)) because unquote() returns str, not bytes. |
The encodestring() function is refered to in the docs as "the legacy |
Hi Dmitry, RE the method behaviour: I think it probably is correct to NOT accept a RE the method name: I agree, it should be renamed to encodestring. I RE xmlrpc.client:1168. We just checked in a patch to urllib which adds |
I agree.
Huh ? It is already called that :) IMO it should be renamed to
Oh well. |
Um ... yes. I mean encodebytes :)
But I don't know the rules. People are saying things like "no new But maybe it's still OK for us to break code after the beta. Perhaps |
Did someone fix xmlrpc.client:1168 yet? IMO it's okay to add encodebytes(), but let's leave encodestring() |
Here's a trivial patch for xmlrpc.client:1168. The testcase below import xmlrpc.client
transp = xmlrpc.client.Transport()
transp.get_host_info("user@host.tld") |
Applied the patch in r69575. |
We still need to solve the encodebytes/encodestring stuff. |
I've attached a patch which renames encodestring to encodebytes (keeping I also renamed decodestring to decodebytes, because it also refuses to |
Now, base64.encodestring and decodestring seem a bit weird because the It seems to me that once something is Base64-encoded, it's considered to Hence, base64.encodestring (which should be "encodebytes") should take a I've attached an alternative patch, encodebytes_new_types.patch (which,
This isn't a proper patch (it breaks a lot of other code which I haven't |
Applied a patch to rename (and keep old aliases) in r73204. |
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: