Skip to content

pylibfdt: Replace removed SWIG Python 2 compatibility macros - #192

Merged
dgibson merged 1 commit into
dgibson:mainfrom
nullr0ute:swig-4.5
Aug 8, 2026
Merged

pylibfdt: Replace removed SWIG Python 2 compatibility macros#192
dgibson merged 1 commit into
dgibson:mainfrom
nullr0ute:swig-4.5

Conversation

@nullr0ute

Copy link
Copy Markdown

SWIG 4.5.0 removed Python 2 compatibility macros (PyInt_, PyString_) from its runtime header pyhead.swg (see commit 79f7a2b7cb7d). Replace them with their Python 3 C API equivalents:

  • PyString_FromString -> PyUnicode_FromString
  • PyString_AsString -> PyBytes_AsString
  • PyInt_AsLong -> PyLong_AsLong

The replacements are safe since the macros were already aliased to these exact functions in SWIG's Python 3 code path.

SWIG 4.5.0 removed Python 2 compatibility macros (PyInt_*, PyString_*)
from its runtime header pyhead.swg (see commit 79f7a2b7cb7d). Replace
them with their Python 3 C API equivalents:

- PyString_FromString -> PyUnicode_FromString
- PyString_AsString -> PyBytes_AsString
- PyInt_AsLong -> PyLong_AsLong

The replacements are safe since the macros were already aliased to
these exact functions in SWIG's Python 3 code path.

Signed-off-by: Jitka Plesnikova <jplesnik@redhat.com>
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
@dgibson
dgibson merged commit 5008d1d into dgibson:main Aug 8, 2026
18 checks passed
@dgibson

dgibson commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Merged, thanks!

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.

3 participants