[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-24 Thread Larry Hastings
Larry Hastings added the comment: I can't reproduce this, and it was pretty late in my day when I saw it, so let's assume I was mistaken and PyBytes_CheckBuffer() works fine. Nevertheless I think the patch is a good idea--why create a new object when you don't have to? Unless I hear otherwi

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-24 Thread Stefan Krah
Stefan Krah added the comment: I also wonder how the buffer interface section can fail. PyBuffer_ToContiguous() should translate to a simple memcpy() for a bytes object. What is going on? -- nosy: +skrah ___ Python tracker

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: Well, the patch is nice but the PyObject_CheckBuffer(...) part should have succeeded, so it's a bit mysterious why it doesn't. -- nosy: +pitrou ___ Python tracker ___

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: > 2) It fails, as in, it returns NULL. It's not my experience. Do you have an example? -- ___ Python tracker ___

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Larry Hastings
Larry Hastings added the comment: 1) Yes, whoopsies. It's late. 2) It fails, as in, it returns NULL. -- ___ Python tracker ___ ___

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: I suppose you are referring to PyUnicode_FromObject() and PyBytes_FromObject()... And by "it fails" did you simply mean "it fails to return the same object"? -- nosy: +amaury.forgeotdarc ___ Python tracker

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Larry Hastings
Larry Hastings added the comment: The appropriate four line patch. (Six with whitespace.) -- keywords: +patch stage: needs patch -> patch review Added file: http://bugs.python.org/file25682/larry.pybytes_fromobject.identity.1.diff ___ Python tracke

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Hynek Schlawack
Changes by Hynek Schlawack : -- nosy: +hynek ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Larry Hastings
New submission from Larry Hastings : If you pass a valid PyUnicodeObject into PyUnicode_AsObject(), it incref's the original object and returns it. If you pass a valid PyBytesObject into PyBytes_AsObject()... it fails. I assert that in the PyBytes_AsObject() should behave like PyUnicode_AsObje