bpo-32030: Add _Py_EncodeLocaleRaw()#4961
Merged
vstinner merged 1 commit intopython:masterfrom Dec 21, 2017
vstinner:encode_raw
Merged
bpo-32030: Add _Py_EncodeLocaleRaw()#4961vstinner merged 1 commit intopython:masterfrom vstinner:encode_raw
vstinner merged 1 commit intopython:masterfrom
vstinner:encode_raw
Conversation
Replace Py_EncodeLocale() with _Py_EncodeLocaleRaw() in: * _Py_wfopen() * _Py_wreadlink() * _Py_wrealpath() * _Py_wstat() * pymain_open_filename() These functions are called early during Python intialization, only the RAW memory allocator must be used.
SylvainDe
reviewed
Dec 21, 2017
| len = wcslen(text); | ||
|
|
||
| result = PyMem_Malloc(len + 1); /* +1 for NUL byte */ | ||
| /* +1 for NUL byte */ |
Contributor
There was a problem hiding this comment.
Not related to your change but should it be "NULL byte" ?
Member
Author
There was a problem hiding this comment.
Oops, I only saw your review after I merged my PR. Anyway, I fixed this typo in my following PR: PR #4963.
SylvainDe
reviewed
Dec 21, 2017
| if (converted == (size_t)-1) { | ||
| if (result != NULL) | ||
| PyMem_Free(result); | ||
| if (result != NULL) { |
Contributor
There was a problem hiding this comment.
Once again, not quite related to your change but if PyMem_RawFree and PyMem_Free behave like free, it should be valid to pass a NULL argument and the test is not needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace Py_EncodeLocale() with _Py_EncodeLocaleRaw() in:
These functions are called early during Python intialization, only
the RAW memory allocator must be used.
https://bugs.python.org/issue32030