SDL_JoystickGetGUIDString crashes CPython interperter but not PyPy

Issue #75 open
Arthur Yidi created an issue
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER)
numJoys = SDL_NumJoysticks()
joyA = SDL_JoystickOpen(0)
SDL_JoystickNameForIndex(0)
SDL_JoystickGetAttached(joyA)
SDL_JoystickInstanceID(joyA)
guidA = SDL_JoystickGetGUID(joyA)

buff = create_string_buffer(33)
size = sizeof(buff)
# crash here
SDL_JoystickGetGUIDString(guidA, buff, size)

Comments (8)

  1. Kentzo

    This one should work though:

    def SDL_JoystickGetGUIDString(guid):
        s = ''
        for g in guid.data:
            s += "{:x}".format(g >> 4)
            s += "{:x}".format(g & 0x0F)
        return s
    
  2. Log in to comment