Conversation
SWIG 4.5.0 removed the Python 2 compatibility aliases that pyhead.swg
previously injected into every generated Python wrapper:
#define PyString_AsString(str) PyBytes_AsString(str)
#define PyString_Size(str) PyBytes_Size(str)
#define PyInt_FromLong(x) PyLong_FromLong(x)
...
GDCM's hand-written typemaps still use the Python 2 names, so with
SWIG 4.5.0 the generated gdcmswigPYTHON_wrap.cxx fails to compile:
error: 'PyString_AsString' was not declared in this scope
error: 'PyInt_FromLong' was not declared in this scope
Replace them with the Python 3 C-API calls the aliases expanded to,
which is also behavior-identical to what SWIG <= 4.4 produced when
targeting Python 3 (byte string argument, list of ints).
Assisted-by: Sisyphus (Kimi K3) via OpenCode
Contributor
|
Yep, I also had pointed this out earlier. The Python detection itself is still Python 2.x as far as I recall (see d528f5e). |
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.
GDCM fails to compile with SWIG 4.5.0, which removed the Python 2 compatibility aliases, causing compiler errors like
Since Python 2 is long dead, these should be replaced in the hand-written gdcmswig.i and gdcmcommon.i files.