From a57ae4fc76c791774b9a953cc2b3244a226f23a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigurd=20Lj=C3=B8dal?= <544451+ljodal@users.noreply.github.com> Date: Mon, 15 Nov 2021 16:14:42 +0100 Subject: [PATCH] Fix BaseConnectionWrapper.execute_wrapper (#752) This is a context manager, not an iterator. Currently mypy will complain if it's used as documented. --- django-stubs/db/backends/base/base.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django-stubs/db/backends/base/base.pyi b/django-stubs/db/backends/base/base.pyi index 233d828..fa81b30 100644 --- a/django-stubs/db/backends/base/base.pyi +++ b/django-stubs/db/backends/base/base.pyi @@ -1,5 +1,5 @@ from datetime import tzinfo -from typing import Any, Callable, Dict, Iterator, List, Optional, Type, TypeVar +from typing import Any, Callable, ContextManager, Dict, Iterator, List, Optional, Type, TypeVar from django.db.backends.base.client import BaseDatabaseClient from django.db.backends.base.creation import BaseDatabaseCreation @@ -98,5 +98,5 @@ class BaseDatabaseWrapper: def schema_editor(self, *args: Any, **kwargs: Any) -> BaseDatabaseSchemaEditor: ... def on_commit(self, func: Callable[[], None]) -> None: ... def run_and_clear_commit_hooks(self) -> None: ... - def execute_wrapper(self, wrapper: _ExecuteWrapper) -> Iterator[None]: ... + def execute_wrapper(self, wrapper: _ExecuteWrapper) -> ContextManager[None]: ... def copy(self: _T, alias: Optional[str] = ...) -> _T: ...