[pypy-commit] pypy default: merge heads

mattip noreply at buildbot.pypy.org
Thu Apr 4 22:03:54 CEST 2013


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r63017:8dc0b7d3bb76
Date: 2013-04-04 22:56 +0300
http://bitbucket.org/pypy/pypy/changeset/8dc0b7d3bb76/

Log:	merge heads

diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -385,9 +385,10 @@
             self.cache[sql] = stat
             if len(self.cache) > self.maxcount:
                 self.cache.popitem(0)
-
-        if stat._in_use:
-            stat = Statement(self.connection, sql)
+        else:
+            if stat._in_use:
+                stat = Statement(self.connection, sql)
+                self.cache[sql] = stat
         stat._row_factory = row_factory
         return stat
 
@@ -855,10 +856,6 @@
 
         self.__initialized = True
 
-    def __del__(self):
-        if self.__statement:
-            self.__statement._reset()
-
     def close(self):
         self.__connection._check_thread()
         self.__connection._check_closed()
diff --git a/pypy/module/test_lib_pypy/test_sqlite3.py b/pypy/module/test_lib_pypy/test_sqlite3.py
--- a/pypy/module/test_lib_pypy/test_sqlite3.py
+++ b/pypy/module/test_lib_pypy/test_sqlite3.py
@@ -96,18 +96,6 @@
      pytest.raises(_sqlite3.ProgrammingError, "cur.executemany(1,2,3,4,5)")
 
 @pytest.mark.skipif("not hasattr(sys, 'pypy_translation_info')")
-def test_cursor_del():
-    con = _sqlite3.connect(':memory:')
-    cur = con.execute('select 1')
-    stmt = cur._Cursor__statement
-    cur.close()
-    cur = con.execute('select 1')
-    assert cur._Cursor__statement is stmt
-    del cur; import gc; gc.collect(); gc.collect()
-    cur = con.execute('select 1')
-    assert cur._Cursor__statement is stmt
-
- at pytest.mark.skipif("not hasattr(sys, 'pypy_translation_info')")
 def test_connection_del(tmpdir):
     """For issue1325."""
     import os
diff --git a/rpython/translator/c/src/mem.h b/rpython/translator/c/src/mem.h
--- a/rpython/translator/c/src/mem.h
+++ b/rpython/translator/c/src/mem.h
@@ -195,8 +195,24 @@
                                              "g" (v))
 
 /* marker for trackgcroot.py, and inhibits tail calls */
-#define pypy_asm_stack_bottom()  asm volatile ("/* GC_STACK_BOTTOM */" : : : \
-                                               "memory")
+#define pypy_asm_stack_bottom()  { asm volatile ("/* GC_STACK_BOTTOM */" : : : \
+                                   "memory"); pypy_check_stack_count(); }
+
+static void pypy_check_stack_count(void)
+{
+#ifdef RPY_ASSERT
+    void *anchor = (void*)&pypy_g_ASM_FRAMEDATA_HEAD;
+    void *fd = ((void* *) (((char *)anchor) + sizeof(void*)))[0];
+    long got = 0;
+    long stacks_counter =
+       (&pypy_g_rpython_rtyper_lltypesystem_rffi_StackCounter)->sc_inst_stacks_counter;
+    while (fd != anchor) {
+        got += 1;
+        fd = ((void* *) (((char *)fd) + sizeof(void*)))[0];
+    }
+    assert(got == stacks_counter || ((got == 0) && (stacks_counter == 1)));
+#endif
+}
 
 #define OP_GC_ASMGCROOT_STATIC(i, r)   r =	       \
 	i == 0 ? (void*)&__gcmapstart :		       \


More information about the pypy-commit mailing list