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
struct.unpack and cStringIO.StringIO don't support new buffer #54421
Comments
When doing socket IO, it is beneficial to use a bytearra() and then using sock.recv_into() to avoid moving data about. The attached patch adds new-buffer support to the struct module and cStringIO. |
You can't add buffer protocol support to cStringIO in a bugfix release, since it would be a new feature. |
I disagree. It's not a new feature. We're merely completing an old feature (adding new-style buffers from 3.x to 2.7) that wasn't fully implemented. by the core. The new buffer isn't accepted in a lot of places where you'd expect it to be. The good alternative, of course, would be to add this to "trunk" but for some reason that is frowned upon. See also bpo-10211 |
MAL’s viewpoint from msg119721: “The memoryview object was added to simplify porting applications to Python3. If that backport is incomplete in the sense that the memoryview object is not compatible with the standard Python2 object for such memory views, then I'd consider that a bug. Without compatibility to the buffer objects, there's no way to make other Python2 buffer interface compatible object compatible to memoryviews. Alternatively, the Python2 memoryview object implementation could also accept objects with the old buffer interface, much like "s*" does. Note that the patch needs to check the buffer flags - writing to such buffers is not allowed.” |
In the absence of doc references in this and bpo-10211 that would *clearly* settle the bug vs. feature issue, it strikes me as a bit murky. So I am inclined to agree with MAL that failure to achieve the stated, documented purpose is a bug. I strongly suspect that if these issues had been filed during the 2.7 beta phase, a fix would have been deemed permissible without much controversy. |
The patch is still there. Any new consensus? |
Stefan, since you have been working on Memoryview, any opinions? |
We don't seem to be getting any traction on this. 2.7.4 is to be cut next weekend so it is becoming more urgent :) |
For the backport policy question, since there seems to be disagreement, consider a post on pydev asking for discussion and if no quick consensus, a ruling from Guido or designee. |
Patch looks good to me. I would call it a bugfix, not a feature. |
New changeset be4bec689de3 by Kristján Valur Jónsson in branch '2.7': |
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: