-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Make several type aliases private #7661
Conversation
@@ -410,8 +410,6 @@ class InternalError(DatabaseError): ... | |||
class NotSupportedError(DatabaseError): ... | |||
class OperationalError(DatabaseError): ... | |||
|
|||
OptimizedUnicode = str |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It exists at runtime in 3.6-3.9: https://github.com/python/cpython/blob/3.6/Modules/_sqlite/module.c#L421, https://github.com/python/cpython/blob/636832fb2a4364ca2014aadecf4c35833eff4495/Modules/_sqlite/module.c#L439
Could you add it back with a version guard?
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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?
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
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.)