|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] tools/libxl: Make gentypes.py compatible with older Python
On 17.10.2025 04:06, Jason Andryuk wrote:
> removeprefix is only added in Python 3.9.
>
> Instead of the prefix removal, switch to passing in a "depth" parameter,
> and incrementing it for each level.
>
> There is a slight change in the generated _libxl_types.c. instances of
> KeyedUnion increment depth without outputing any code. The net result
> is some cases where jso_sub_1 is followed by jso_sub_3. As an example:
>
> _libxl_types.c
> _libxl_types.c
> @@ -5535,12 +5535,12 @@
> if (!jso_sub_1)
> goto out;
> if (!libxl__string_is_default(&p->u.pty.path)) {
> - json_object *jso_sub_2 = NULL;
> - rc = libxl__string_gen_jso(&jso_sub_2, p->u.pty.path);
> + json_object *jso_sub_3 = NULL;
> + rc = libxl__string_gen_jso(&jso_sub_3, p->u.pty.path);
> if (rc)
> goto out;
> - if (json_object_object_add(jso_sub_1, "path",
> jso_sub_2)) {
> - json_object_put(jso_sub_2);
> + if (json_object_object_add(jso_sub_1, "path",
> jso_sub_3)) {
> + json_object_put(jso_sub_3);
> goto out;
> }
> }
>
> Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
> ---
> Here's an alternative approach to workaround removeprefix.
Fine with me; it's really Anthony's call. (He'll be back on Monday, aiui.)
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |