fetchmany() fails on bufferedcolproxy on second call w/ no rows

Issue #3329 resolved
Mike Bayer repo owner created an issue
diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py
index 730ef44..a5318c0 100644
--- a/test/engine/test_execute.py
+++ b/test/engine/test_execute.py
@@ -1070,6 +1070,9 @@ class AlternateResultProxyTest(fixtures.TestBase):
         rows = r.fetchmany(6)
         eq_(rows, [(i, "t_%d" % i) for i in range(1, 6)])

+        rows = r.fetchmany(2)
+        eq_(rows, [])
+
     def test_plain(self):
         self._test_proxy(_result.ResultProxy)

Comments (2)

  1. Mike Bayer reporter
    • The "auto close" for :class:.ResultProxy is now a "soft" close. That is, after exhausing all rows using the fetch methods, the DBAPI cursor is released as before and the object may be safely discarded, but the fetch methods may continue to be called for which they will return an end-of-result object (None for fetchone, empty list for fetchmany and fetchall). Only if :meth:.ResultProxy.close is called explicitly will these methods raise the "result is closed" error. fixes #3330 fixes #3329

    → <<cset b7e151ac5cf5>>

  2. Log in to comment