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

Update transaction.pyi #268

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Update transaction.pyi #268

merged 1 commit into from
Sep 25, 2024

Conversation

rayansostenes
Copy link

Make transaction.atomic compatible with AbstractContextManager protocol.

Currently the following error is reported by pyright:

from contextlib import AbstractContextManager
from django.db import transaction

x: AbstractContextManager[None, None] = transaction.atomic()
Type "Atomic" is not assignable to declared type "AbstractContextManager[None, None]"
  "Atomic" is incompatible with protocol "AbstractContextManager[None, None]"
    "__exit__" is an incompatible type
      Type "(exc_type: None, exc_value: None, traceback: None) -> None" is not assignable to type "(exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /) -> _ExitT_co@AbstractContextManager"
        Parameter 1: type "type[BaseException] | None" is incompatible with type "None"
          Type "type[BaseException] | None" is not assignable to type "None"
        Parameter 2: type "BaseException | None" is incompatible with type "None"
          Type "BaseException | None" is not assignable to type "None"
        Parameter 3: type "TracebackType | None" is incompatible with type "None"
        

Copy link
Owner

@sbdchd sbdchd left a comment

Choose a reason for hiding this comment

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

Thanks!

@kodiakhq kodiakhq bot merged commit 610f267 into sbdchd:main Sep 25, 2024
2 checks passed
@rayansostenes rayansostenes deleted the patch-2 branch September 25, 2024 18:22
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