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

Fix for a missing macro in python 3.11 #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrisBrookes93
Copy link

@chrisBrookes93 chrisBrookes93 commented Oct 28, 2022

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

@chrisBrookes93
Copy link
Author

There isn't an appveyor image with python3.11 right now: https://www.appveyor.com/docs/windows-images-software/#python

But the tests do pass locally:

image

@chrisBrookes93
Copy link
Author

@mcfletch Would you mind taking a look at this when you get a second please? :)

@chrisBrookes93
Copy link
Author

@mcfletch any chance of moving this forward?

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.

None yet

1 participant