[Python-checkins] cpython (2.7): Fix a variable scoping error in an sqlite3 test

petri.lehtinen python-checkins at python.org
Fri Feb 17 20:47:57 CET 2012


http://hg.python.org/cpython/rev/ce023c95db9f
changeset:   75007:ce023c95db9f
branch:      2.7
parent:      74996:a65a71aa9436
user:        Petri Lehtinen <petri at digip.org>
date:        Fri Feb 17 21:34:41 2012 +0200
summary:
  Fix a variable scoping error in an sqlite3 test

Initial patch by Torsten Landschoff.

Closes #11689.

files:
  Lib/sqlite3/test/hooks.py |  6 +++---
  Misc/ACKS                 |  1 +
  Misc/NEWS                 |  3 +++
  3 files changed, 7 insertions(+), 3 deletions(-)


diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py
--- a/Lib/sqlite3/test/hooks.py
+++ b/Lib/sqlite3/test/hooks.py
@@ -166,14 +166,14 @@
         Test that setting the progress handler to None clears the previously set handler.
         """
         con = sqlite.connect(":memory:")
-        action = 0
+        action = []
         def progress():
-            action = 1
+            action.append(1)
             return 0
         con.set_progress_handler(progress, 1)
         con.set_progress_handler(None, 1)
         con.execute("select 1 union select 2 union select 3").fetchall()
-        self.assertEqual(action, 0, "progress handler was not cleared")
+        self.assertEqual(len(action), 0, "progress handler was not cleared")
 
 def suite():
     collation_suite = unittest.makeSuite(CollationTests, "Check")
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -475,6 +475,7 @@
 Kirill Kuzminykh (Кирилл Кузьминых)
 Ross Lagerwall
 Cameron Laird
+Torsten Landschoff
 Łukasz Langa
 Tino Lange
 Andrew Langmead
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -526,6 +526,9 @@
 Tests
 -----
 
+- Issue #11689: Fix a variable scoping error in an sqlite3 test.
+  Initial patch by Torsten Landschoff.
+
 - Issue #13304: Skip test case if user site-packages disabled (-s or
   PYTHONNOUSERSITE).  (Patch by Carl Meyer)
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list