lv_binding_micropython icon indicating copy to clipboard operation
lv_binding_micropython copied to clipboard

Python 3.8 issue

Open ExtraTon618 opened this issue 1 year ago • 0 comments

The cloned code doesn't compile with Python 3.8. due to the addition of *get_user_... operator on gen_mpy.py. I have changed this to be compatible with previous versions of Python. Please commit this! Thanks a lot ! gen_mpy.patch

diff --git a/gen/gen_mpy.py b/gen/gen_mpy.py index 23749b7..0b8437e 100644 --- a/gen/gen_mpy.py +++ b/gen/gen_mpy.py @@ -1847,8 +1847,6 @@ def get_user_data(func, func_name = None, containing_struct = None, containing_s if not func_name: func_name = get_arg_name(func.type) # print('/* --> callback: func_name = %s, args = %s */' % (func_name, repr(args))) user_data_found = False

  • getter = None
  • setter = None user_data = 'None' if len(args) > 0 and isinstance(args[0].type, c_ast.PtrDecl): # if isinstance(args[0].type.type.type, c_ast.Struct): @@ -1881,15 +1879,7 @@ def get_user_data(func, func_name = None, containing_struct = None, containing_s containing_struct_j = next((struct for struct in lvgl_json["structures"] if struct["name"] == struct_arg_type_name_with_underscore), None) if containing_struct_j is not None: user_data_found = any(user_data == field["name"] for field in containing_struct_j["fields"])
  •                getter, setter = get_user_data_accessors(containing_struct, containing_struct_name)
    
  •                 # Ensure that getter and setter are initialized
    
  •                # Ensure that getter and setter are initialized
    
  •                if not getter:
    
  •                   getter = None
    
  •                if not setter:
    
  •                   setter = None
    
  • return (user_data if user_data_found else None), getter, setter -# return (user_data if user_data_found else None), *get_user_data_accessors(containing_struct, containing_struct_name)
  • return (user_data if user_data_found else None), *get_user_data_accessors(containing_struct, containing_struct_name)

ExtraTon618 avatar Oct 15 '24 21:10 ExtraTon618