Skip to content
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

Preserve bytes immutability. #1680

Merged
merged 4 commits into from
Jun 16, 2020
Merged

Conversation

mesalu
Copy link
Collaborator

@mesalu mesalu commented Jun 15, 2020

nanosvg modifies its input char arrays in place (see: https://github.com/wxWidgets/nanosvg/blob/9dd92bbfc6f709e889578a724724ffbd42ac3004/src/nanosvg.h#L348),
which will lead to issues attempting to use the same python bytes object multiple times. Since bytes objects promise immutability its undesirable to permit them to be modified like this.
To correct for this, we'll copy the bytes object into a new location in memory and pass that new memory location to nanosvg.

mesalu added 4 commits June 15, 2020 13:34
`nanosvg` modifies its input strings in place (see: https://github.com/wxWidgets/nanosvg/blob/9dd92bbfc6f709e889578a724724ffbd42ac3004/src/nanosvg.h#L348),
which will lead to issues attempting to use the same python `bytes` object multiple times. Since bytes objects promise immutability its undesirable to permit them to be modified like this.
To correct for this, we'll copy the bytes object into a new location in memory and pass that new memory location to nanosvg.
@RobinD42 RobinD42 merged commit 3923a16 into master Jun 16, 2020
@RobinD42 RobinD42 deleted the nsvg_preserve_immutability_of_bytes branch June 17, 2020 00:37
@RobinD42
Copy link
Member

This pull request has been mentioned on Discuss wxPython. There might be relevant details there:

https://discuss.wxpython.org/t/wxpython-4-1-1-released/35043/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants