Skip to content

Make several type aliases private #7661

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 2 commits into from
Apr 18, 2022

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Apr 18, 2022

None of these exist at runtime, except for sqlite3.dbapi2.OptimizedUnicode, which exists on <3.10. (All of these were picked up by python/mypy#12608.)

@@ -410,8 +410,6 @@ class InternalError(DatabaseError): ...
class NotSupportedError(DatabaseError): ...
class OperationalError(DatabaseError): ...

OptimizedUnicode = str
Copy link
Member Author

Choose a reason for hiding this comment

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

This one doesn't seem to exist at runtime or be used in the stub

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, I'd just figured it out from the mypy failures :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not 100% sure whether it's better to do

OptimizedUnicode = str

or

OptimizedUnicode: TypeAlias = str

or

from builtins import str as OptimizedUnicode

Thoughts?

@AlexWaygood AlexWaygood marked this pull request as draft April 18, 2022 21:06
@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood marked this pull request as ready for review April 18, 2022 21:14
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood merged commit 3930d8d into python:master Apr 18, 2022
@AlexWaygood AlexWaygood deleted the fictitious-type-aliases branch April 18, 2022 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants