Fix for a missing macro in python 3.11 #18
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.
There are still lots of deprecation warning when building (as there was in the previous release), but this fixes compilation errors when trying to build/install in python 3.11:
Fixes for the errors:
simpleparse/stt/TextTools/mxTextTools/mxTextTools.c:2901:6: error: implicit declaration of function 'Py_UNICODE_COPY' is invalid in C99 [-Werror,-Wimplicit-function-declaration] Py_UNICODE_COPY(p, sep, sep_len); ^ simpleparse/stt/TextTools/mxTextTools/mxTextTools.c:2907:2: error: implicit declaration of function 'Py_UNICODE_COPY' is invalid in C99 [-Werror,-Wimplicit-function-declaration] Py_UNICODE_COPY(p, st, len_st);
Following suggested guidance here: https://docs.python.org/3.11/whatsnew/3.11.html#:~:text=Remove%20Py_UNICODE_COPY()%20and%20Py_UNICODE_FILL()%20macros%2C%20deprecated%20since%20Python%203.3.%20Use%20PyUnicode_CopyCharacters()%20or%20memcpy()%20(wchar_t*%20string)%2C%20and%20PyUnicode_Fill()%20functions%20instead.%20(Contributed%20by%20Victor%20Stinner%20in%20bpo%2D41123.)
The previous implemented (
Py_UNICODE_COPY
, here: https://github.com/python/cpython/pull/28887/files#diff-6be7f081fe6c5e9cbc89323a00399b291d1cda855bcb4c6eeaee0fac89c2f8ddL54) is using a mem copy which assumes 0 indexes for the source and target array. Uplifted code to use the new suggested function with explicit 0 indexes