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 <[email protected]>
---
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:

Reply via email to