From: Suresh Kumar Date: Sat, 23 Oct 2021 14:45:36 +0000 (+0530) Subject: fix: check if cursor is closed X-Git-Tag: 3.0.2~11^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6363a0c00fcd14669985b63c9eb8fd009fe76a90;p=thirdparty%2Fpsycopg.git fix: check if cursor is closed --- diff --git a/psycopg/psycopg/cursor.py b/psycopg/psycopg/cursor.py index cbc1dda97..71b66cb90 100644 --- a/psycopg/psycopg/cursor.py +++ b/psycopg/psycopg/cursor.py @@ -451,6 +451,8 @@ class BaseCursor(Generic[ConnectionType, Row]): ) def _check_result(self) -> None: + if self._conn.closed: + raise e.InterfaceError("the cursor is closed") res = self.pgresult if not res: raise e.ProgrammingError("no result available")