All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-4.21] libxl: make gentypes.py compatible with Python older than 3.9
@ 2025-10-16 11:22 Jan Beulich
  2025-10-16 11:45 ` Andrew Cooper
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Jan Beulich @ 2025-10-16 11:22 UTC (permalink / raw)
  To: xen-devel@lists.xenproject.org
  Cc: Anthony PERARD, Juergen Gross, Oleksii Kurochko

removeprefix() was added only in 3.9. As long as the "jso_sub_" prefix is
always going to be there anyway, switch to a less specific but more
compatible construct.

Fixes: f6c6f2679d49 ("libxl: libxl__object_to_json() to json-c")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Sadly this is only the tip of the iceberg. Some minimum version of the
json-c library is apparently needed for the toolstack to build, but no
minimum version is being checked for.

--- a/tools/libs/light/gentypes.py
+++ b/tools/libs/light/gentypes.py
@@ -384,7 +384,7 @@ def libxl_C_type_gen_jso(ty, v, indent =
         s += "int rc;\n"
         sub_scope_object = "jso_sub_1"
     else:
-        sub_scope_object = "jso_sub_%d" % (1+int(scope_object.removeprefix("jso_sub_")))
+        sub_scope_object = "jso_sub_%d" % (1+int(scope_object[8:]))
 
     if isinstance(ty, idl.Array):
         if parent is None:


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-10-21 17:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16 11:22 [PATCH for-4.21] libxl: make gentypes.py compatible with Python older than 3.9 Jan Beulich
2025-10-16 11:45 ` Andrew Cooper
2025-10-16 11:51   ` Jan Beulich
2025-10-17  2:06     ` [PATCH] tools/libxl: Make gentypes.py compatible with older Python Jason Andryuk
2025-10-17  6:02       ` Jan Beulich
2025-10-21 16:23       ` Anthony PERARD
2025-10-21 16:31         ` Andrew Cooper
2025-10-21 17:20           ` Jason Andryuk
     [not found]     ` <0a78d0993fc44d6cae0a363cc875b6da@DM4PR03MB7015.namprd03.prod.outlook.com>
2025-10-21 16:00       ` Andrew Cooper
2025-10-16 15:28 ` [PATCH for-4.21] libxl: make gentypes.py compatible with Python older than 3.9 Oleksii Kurochko
2025-10-21 14:51 ` Anthony PERARD
2025-10-21 15:21   ` Jan Beulich

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.