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

Mark old xType aliases as deprecated #3288

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

Conversation

Starbuck5
Copy link
Member

Starts to handle #3239

It would be a huge pain to put in deprecation warnings about this, but the deprecation decorator is easy and we're now using it in other places so lets use it here.

Doesn't touch JoystickType because the C code still works the old way I think, doesn't touch CameraType because CameraType is not in the stubs. In fact CameraType might be removable as an internal implementation detail.

Doesn't touch JoystickType because the C code still works the old way I think, doesn't touch CameraType because CameraType is not in the stubs. In fact CameraType might be removable as an internal implementation detail.
class RectType(Rect): ...

@deprecated("Use `FRect` instead (this is an old alias)")
class FRectType(FRect): ...
Copy link
Member

Choose a reason for hiding this comment

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

Not really a review but an observation, it's funny that FRectType exists in the first place because I'm fairly sure FRect was added after we decided that *Type was not needed anymore and stopped doing it.

class EventType:
# Duplicated Event fields here because it is marked as final and can't be
# subclassed like the other xType aliases are to allow @deprecated.

Copy link
Member

Choose a reason for hiding this comment

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

I like how all other instances are elegantly marked as deprecated without duplication, and there's there's this that sticks out.
I get why it's done, but can we find a workaround that doesn't need the duplication? Something like

EventType = deprecated("Use Event instead (this is an old alias)")(Event) should be a one-liner that could work? If it does, this style could be used everywhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants