We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
GitHub fields:
assignee = None closed_at = None created_at = <Date 2020-11-19.13:41:25.178> labels = [] title = 'passing memoryview slice to struct packing functions' updated_at = <Date 2020-11-19.13:41:25.178> user = 'https://github.com/danielhrisca'
bugs.python.org fields:
activity = <Date 2020-11-19.13:41:25.178> actor = 'danielhrisca' assignee = 'none' closed = False closed_date = None closer = None components = [] creation = <Date 2020-11-19.13:41:25.178> creator = 'danielhrisca' dependencies = [] files = [] hgrepos = [] issue_num = 42408 keywords = [] message_count = 1.0 messages = ['381413'] nosy_count = 1.0 nosy_names = ['danielhrisca'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = None url = 'https://bugs.python.org/issue42408' versions = []
The text was updated successfully, but these errors were encountered:
First I have to apologize if this was discussed before; I've searched the issues and googled the problem but I got nothing obvious.
I'm trying to pass a memoryview slice as argument to struct packing functions to avoid creating intermediate bytes objects
from struct import Struct s = Struct('<2Q500s').pack_into buffer = bytearray(7000) data = bytes(300) s(buffer, 0, 500, 500, memoryview(data)[4:])
and I get this error: error: argument for 's' must be a bytes object
Why is it not possible to use memoryviews in this case?
It is also strange for me that we can use a memoyview as the target buffer, so this works fine:
s(memoryview(buffer)[10:], 0, 500, 500, data[4:])
Sorry, something went wrong.
No branches or pull requests
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: