Skip to content

Preserve bytes immutability.#1680

Merged
RobinD42 merged 4 commits into
masterfrom
nsvg_preserve_immutability_of_bytes
Jun 16, 2020
Merged

Preserve bytes immutability.#1680
RobinD42 merged 4 commits into
masterfrom
nsvg_preserve_immutability_of_bytes

Conversation

@mesalu

@mesalu mesalu commented Jun 15, 2020

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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