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
py3k-pep3137: issue warnings / errors on str(bytes()) and similar operations #45733
Comments
str(bytes()) == repr(bytes()) and str(buffer()) == repr(buffer()) is |
Err, please remove the (reprfunc) cast and check the language of the |
Here is an updated patch that fixes an error in httplib that was causing |
I'll look at the patches later, but we've gone over this before on the |
Guido van Rossum wrote:
Can we agree to a compromise and make str(bytes()) return Christian |
New patch: static PyObject *
string_str(PyObject *op)
{
return PyObject_CallMethod(op, "decode", "s", "ascii");
} |
No -- making str(b) return b.decode("ascii") brings back the same issues |
A compromise I could live with: add a command line option that makes it |
Guido van Rossum wrote:
Good idea. I can live with it, too. :) How do you like -b: issue warnings about str(bytes_instance) and str(buffer_instance) Christian |
I've made a patch with -b -> warning and -bb > type error. I'm not happy |
The error message is fine, though you could drop the word "Calling" Perhaps you could expand this to also add a trap in the comparison |
Guido van Rossum wrote:
It's sounds like a reasonable idea. But first I'm going to hit the down PS: In my humble opinion Amaury Forgeot d'Arc deserves an entry in the |
No! You're not allowed to have a life! :-) (And no hacking drunk, either. :-)
Agreed -- done! |
Pfff! I've written my best code after having one or two beers :) Updates:
Open questions:
|
Yes, this is is all fine with me. Feel free to submit overnight. |
Applied to py3k-pep3137 in r 58876 |
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: