Skip to content

Fix local stubtest for set_led() #3524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aatle
Copy link
Contributor

@aatle aatle commented Jul 1, 2025

Stubtest correctly fails locally because the color argument of 2 set_led() methods is not typed as positional-only. Fixes the error.
#3507

error: pygame._sdl2.controller.Controller.set_led is inconsistent, stub argument "color" should be positional-only (rename with a leading double underscore, i.e. "__object")
Stub: in file C:\Users\antho\development\pygame-ce\buildconfig\stubs\pygame\_sdl2\controller.pyi:34
def (self: pygame._sdl2.controller.Controller, color: Union[pygame.color.Color, pygame.typing.SequenceLike[builtins.int], builtins.str, builtins.int]) -> builtins.bool
Runtime:
def (self, object, /)

error: pygame.joystick.JoystickType.set_led is inconsistent, stub argument "color" should be positional-only (rename with a leading double underscore, i.e. "__object")
Stub: in file C:\Users\antho\development\pygame-ce\buildconfig\stubs\pygame\joystick.pyi:35
def (self: pygame.joystick.JoystickType, color: Union[pygame.color.Color, pygame.typing.SequenceLike[builtins.int], builtins.str, builtins.int]) -> builtins.bool
Runtime:
def (self, object, /)

Found 2 errors (checked 179 modules)

Since these uncaught issues are common, I did some more investigation and found that only python 3.13 experiences this error. Python versions from 3.9-3.12 did not catch this problem. (3.9 had an unrelated error but it is small and I won't fix it.)
So these errors could appear in GitHub CI later as python versions update.

@aatle aatle requested a review from a team as a code owner July 1, 2025 20:57
@aatle aatle added the type hints Type hint checking related tasks label Jul 1, 2025
Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good catch 🎉

@ankith26 ankith26 added this to the 2.5.6 milestone Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type hints Type hint checking related tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants