Skip to content

Conversation

UnknownPlatypus
Copy link
Contributor

I have made things!

(not ready for review)
Just a failing test for now. Apparently, we were bailing most of the time previously due to this check;

# bail if either mapped_set_type or mapped_get_type have type Never
if not (isinstance(mapped_set_type, UninhabitedType) or isinstance(mapped_get_type, UninhabitedType)):

which is not the case anymore after mypy 1.16

Relate issue

Fixes #2724

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Just a quick note, that strict_optional is soft deprecated and not recommended. I am not sure that we want to add this support. We can add a doc note about it.

@UnknownPlatypus
Copy link
Contributor Author

I do agree this flag is a footgun, we are in the process of removing it at work but it's not that easy around Django models.

We have a bunch of fields that are initially empty but will always be filled at some point in the lifecycle of the object. We struggle to represent that without requiring a bunch of assertion to narrow types all around the place.

But yeah you are probably right that we should not invest time fixing this but just recommend to user to flip the flag

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

Successfully merging this pull request may close these issues.

error: DateTimeField is nullable but its generic get type parameter is not optional
2 participants