Author: Amaury Forgeot d'Arc <[email protected]>
Branch: 
Changeset: r44918:0a6cc0d7268e
Date: 2011-06-14 01:25 +0200
http://bitbucket.org/pypy/pypy/changeset/0a6cc0d7268e/

Log:    (issue750) sqlite3.connect(): implement the non-documented parameter
        "check_same_thread"

diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -275,7 +275,8 @@
     return unicode(x, 'utf-8')
 
 class Connection(object):
-    def __init__(self, database, isolation_level="", detect_types=0, 
timeout=None, cached_statements=None, factory=None):
+    def __init__(self, database, isolation_level="", detect_types=0, 
timeout=None, 
+                 check_same_thread=True, cached_statements=None, factory=None):
         self.db = c_void_p()
         if sqlite.sqlite3_open(database, byref(self.db)) != SQLITE_OK:
             raise OperationalError("Could not open database")
@@ -308,7 +309,8 @@
         self._aggregates = {}
         self.aggregate_instances = {}
         self._collations = {}
-        self.thread_ident = thread_get_ident()
+        if check_same_thread:
+            self.thread_ident = thread_get_ident()
 
     def _get_exception(self, error_code = None):
         if error_code is None:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to