[pypy-svn] pypy default: sqlite: Fix the "adapters" protocol.

amauryfa commits-noreply at bitbucket.org
Wed Feb 9 19:13:28 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r41749:db3e8c4c7432
Date: 2011-02-09 17:05 +0100
http://bitbucket.org/pypy/pypy/changeset/db3e8c4c7432/

Log:	sqlite: Fix the "adapters" protocol.

diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -800,7 +800,7 @@
         if cvt is not None:
             cvt = param = cvt(param)
 
-        adapter = adapters.get(type(param), None)
+        adapter = adapters.get((type(param), PrepareProtocol), None)
         if adapter is not None:
             param = adapter(param)
 
@@ -1015,7 +1015,7 @@
     return 0
 
 def register_adapter(typ, callable):
-    adapters[typ] = callable
+    adapters[typ, PrepareProtocol] = callable
 
 def register_converter(name, callable):
     converters[name.upper()] = callable


More information about the Pypy-commit mailing list