]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
fix: check if cursor is closed
authorSuresh Kumar <sureshdsk91@gmail.com>
Sat, 23 Oct 2021 14:45:36 +0000 (20:15 +0530)
committerSuresh Kumar <sureshdsk91@gmail.com>
Sat, 30 Oct 2021 14:34:04 +0000 (20:04 +0530)
psycopg/psycopg/cursor.py

index cbc1dda9700746f924945c3813d741c9f177a88d..71b66cb9096c4318000f567a3334e61f3a99f99b 100644 (file)
@@ -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")