All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jérémie Dautheribes via U-Boot" <u-boot@lists.u-boot-project.org>
To: u-boot@lists.u-boot-project.org
Subject: Re: [PATCH] pylibfdt: Replace removed SWIG Python 2 compatibility macros
Date: Thu, 13 Aug 2026 15:18:13 +0200	[thread overview]
Message-ID: <458309d9-4655-4cfd-9deb-dc0ce01d7b68@bootlin.com> (raw)
In-Reply-To: <20260811133433.18852-1-jaipaul.cheernam@est.tech>

On 8/11/26 15:34, Jaipaul Cheernam wrote:
> 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.
> 
> This is a backport of dtc commit 5008d1d6a356 ("pylibfdt: Replace
> removed SWIG Python 2 compatibility macros").
> 
> Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
> ---
>   scripts/dtc/pylibfdt/libfdt.i_shipped | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: Jérémie Dautheribes <jeremie.dautheribes@bootlin.com>
Tested-by: Jérémie Dautheribes <jeremie.dautheribes@bootlin.com>

> diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped b/scripts/dtc/pylibfdt/libfdt.i_shipped
> index e4659489..326a15c7 100644
> --- a/scripts/dtc/pylibfdt/libfdt.i_shipped
> +++ b/scripts/dtc/pylibfdt/libfdt.i_shipped
> @@ -1033,7 +1033,7 @@ typedef uint32_t fdt32_t;
>   	PyObject *buff;
>   
>   	if ($1) {
> -		resultobj = PyString_FromString(
> +		resultobj = PyUnicode_FromString(
>   			fdt_string(fdt1, fdt32_to_cpu($1->nameoff)));
>   		buff = PyByteArray_FromStringAndSize(
>   			(const char *)($1 + 1), fdt32_to_cpu($1->len));
> @@ -1064,13 +1064,13 @@ typedef uint32_t fdt32_t;
>           }
>           $1 = PyBytes_AsString($input);
>       %#else
> -        $1 = PyString_AsString($input);   /* char *str */
> +        $1 = PyBytes_AsString($input);   /* char *str */
>       %#endif
>   }
>   
>   /* typemaps used for fdt_next_node() */
>   %typemap(in, numinputs=1) int *depth (int depth) {
> -   depth = (int) PyInt_AsLong($input);
> +   depth = (int) PyLong_AsLong($input);
>      $1 = &depth;
>   }
>   

-- 
Jérémie Dautheribes, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


       reply	other threads:[~2026-08-13 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260811133433.18852-1-jaipaul.cheernam@est.tech>
2026-08-13 13:18 ` Jérémie Dautheribes via U-Boot [this message]
2026-08-13 17:28 ` [PATCH] pylibfdt: Replace removed SWIG Python 2 compatibility macros Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=458309d9-4655-4cfd-9deb-dc0ce01d7b68@bootlin.com \
    --to=u-boot@lists.u-boot-project.org \
    --cc=jeremie.dautheribes@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.