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

sqlite3: Avoid optional type for 'description' #7842

Merged
merged 1 commit into from
May 16, 2022

Conversation

JukkaL
Copy link
Contributor

@JukkaL JukkaL commented May 16, 2022

Use the | Any trick instead, since it seems that in a lot of
code the value can be predicted to be non-None (if a query
has been executed previously, I think).

The original type generated false positives in internal code.

The docs don't mention the possibility of this being None, so
it seems likely that a lot of code doesn't check for it:
https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.description

Use the `| Any` trick instead, since it seems that in a lot of
code the value can be predicted to be non-`None` (if a query
has been executed previously, I think).

The original type generated false positives in internal code.

The docs don't mention the possibility of this being `None`, so
it seems likely that a lot of code doesn't check for it:
https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.description
@github-actions
Copy link
Contributor

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

@srittau srittau merged commit 21a81c6 into python:master May 16, 2022
@JukkaL JukkaL deleted the sqlite3-description branch May 16, 2022 14:56
JukkaL added a commit to python/mypy that referenced this pull request May 16, 2022
* gettext: Make GNUTranslations.CONTEXT not final (python/typeshed#7841)
* sqlite3: Avoid optional type for 'description' (python/typeshed#7842)
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