Skip to content

Fixed stub for pygame._sdl2.video.Texture.__init__ #3360

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

Merged
merged 1 commit into from
Mar 1, 2025

Conversation

COUR4G3
Copy link
Contributor

@COUR4G3 COUR4G3 commented Mar 1, 2025

Added the depth argument between size and static as per the Cython function definition.

Very small contribution but I ran into an error where I passed my value for static as a positional argument instead of a keyword-argument and debugged it to find that an argument was missing from the stubs.

For reference, passing True to the depth argument results in an error similar to the following:

  ...
    self._texture = SDL2Texture(display.renderer, surface.size, static, streaming)
  File "video.pyx", line 226, in pygame._sdl2.video.Texture.__init__
  File "video.pyx", line 224, in pygame._sdl2.video.Texture.__init__
  File "video.pyx", line 165, in pygame._sdl2.video.format_from_depth
ValueError: no standard masks exist for given bitdepth with alpha

Added the `depth` argument between `size` and `static` as per the Cython
function definition.
@COUR4G3 COUR4G3 requested a review from a team as a code owner March 1, 2025 13:35
Copy link
Member

@damusss damusss left a comment

Choose a reason for hiding this comment

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

I checked, and the argument does exist in the source but not in the stubs. LGTM, Thanks for contributing! 🎉

@damusss damusss added type hints Type hint checking related tasks _sdl2 pygame._sdl2 labels Mar 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, nice catch! Thanks for contributing 👍

@ankith26 ankith26 added this to the 2.5.4 milestone Mar 1, 2025
@ankith26 ankith26 merged commit 158dbe5 into pygame-community:main Mar 1, 2025
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
_sdl2 pygame._sdl2 type hints Type hint checking related tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants