[Python-checkins] cpython (3.2): be extra careful with a borrowed reference when the GIL could be released

benjamin.peterson python-checkins at python.org
Wed Jun 1 04:32:06 CEST 2011


http://hg.python.org/cpython/rev/a856be6688a6
changeset:   70569:a856be6688a6
branch:      3.2
parent:      70567:d5874854481d
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue May 31 21:31:37 2011 -0500
summary:
  be extra careful with a borrowed reference when the GIL could be released (closes #8578)

files:
  Modules/_sqlite/connection.c |  2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -200,11 +200,13 @@
         weakref = PyList_GetItem(self->statements, i);
         statement = PyWeakref_GetObject(weakref);
         if (statement != Py_None) {
+            Py_INCREF(statement);
             if (action == ACTION_RESET) {
                 (void)pysqlite_statement_reset((pysqlite_Statement*)statement);
             } else {
                 (void)pysqlite_statement_finalize((pysqlite_Statement*)statement);
             }
+            Py_DECREF(statement);
         }
     }
 

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


More information about the Python-checkins mailing list