[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-24 Thread Stefan Krah
Stefan Krah stefan-use...@bytereef.org 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-24 Thread Larry Hastings
Larry Hastings la...@hastings.org 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?

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Larry Hastings
New submission from Larry Hastings la...@hastings.org: 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

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Hynek Schlawack
Changes by Hynek Schlawack h...@ox.cx: -- nosy: +hynek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14889 ___ ___ Python-bugs-list mailing list

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Larry Hastings
Larry Hastings la...@hastings.org 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

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com 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 ___

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Larry Hastings
Larry Hastings la...@hastings.org added the comment: 1) Yes, whoopsies. It's late. 2) It fails, as in, it returns NULL. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14889 ___

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: 2) It fails, as in, it returns NULL. It's not my experience. Do you have an example? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14889

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr 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 rep...@bugs.python.org

[issue14889] PyBytes_FromObject(bytes_object) fails

2012-05-23 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14889 ___ ___ Python-bugs-list mailing list