Skip to content
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

How to fix the recent TypeAlias addition #3149

Closed
damusss opened this issue Oct 6, 2024 · 2 comments · Fixed by #3150
Closed

How to fix the recent TypeAlias addition #3149

damusss opened this issue Oct 6, 2024 · 2 comments · Fixed by #3150
Assignees
Labels
bug Not working as intended typing pygame.typing
Milestone

Comments

@damusss
Copy link
Contributor

damusss commented Oct 6, 2024

A recent PR marked types inside typing.py with TypeAlias, but that object is only available from python 3.10.
We now know how it passed the checks: inside __init__.py we catch import errors, and importing TypeAlias from typing before 3.10 results in an import error, so pygame.typing becomes a missing module with no exception. Once a PR fixing this is merged, the unit test for typing can be merged and issues like this won't appear again.

We can fix this in two ways:

  • remove the addition of TypeAlias
  • version check the relevant bits of the files to use TypeAlias on 3.10+ but use the old system otherwise

The one choosing should be @zoldalma999 as they made the original PR.
:3

@damusss damusss added bug Not working as intended typing pygame.typing labels Oct 6, 2024
@damusss damusss added this to the 2.5.2 milestone Oct 6, 2024
@damusss damusss self-assigned this Oct 6, 2024
@aatle
Copy link
Contributor

aatle commented Oct 6, 2024

Note that typing.py and typing.pyi should exclude TypeAlias in either case, because it is not guaranteed that typing_extensions will be available at runtime.

@ankith26
Copy link
Member

The linked PR puts up what I think is the best fix for now.

@damusss damusss assigned ankith26 and unassigned damusss Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended typing pygame.typing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants