Imported Upstream version 2.4.1 upstream/2.4.1
authorJoel Rosdahl <joel@debian.org>
Mon, 11 Jan 2010 20:41:51 +0000 (21:41 +0100)
committerJoel Rosdahl <joel@debian.org>
Mon, 11 Jan 2010 20:41:51 +0000 (21:41 +0100)
PKG-INFO
pysqlite2/test/regression.py
setup.cfg
src/connection.c
src/module.h

index c3fbe13..1c4c6f5 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.0
 Name: pysqlite
-Version: 2.4.0
+Version: 2.4.1
 Summary: DB-API 2.0 interface for SQLite 3.x
 Home-page: http://pysqlite.org/
 Author: Gerhard Haering
 Author-email: gh@ghaering.de
 License: zlib/libpng license
-Download-URL: http://initd.org/pub/software/pysqlite/releases/2.4/2.4.0/
+Download-URL: http://initd.org/pub/software/pysqlite/releases/2.4/2.4.1/
 Description: Python interface to SQLite 3
         
         pysqlite is an interface to the SQLite 3.x embedded relational database engine.
index 29bb9f9..1dac1e3 100644 (file)
@@ -124,6 +124,18 @@ class RegressionTests(unittest.TestCase):
         """
         self.con.execute("")
 
+    def CheckUnicodeConnect(self):
+        """
+        With pysqlite 2.5.0 you needed to use a string or a APSW connection
+        object for opening database connections.
+
+        Formerly, both bytestrings and unicode strings used to work.
+
+        Let's make sure unicode strings work in the future.
+        """
+        con = sqlite.connect(u":memory:")
+        con.close()
+
 def suite():
     regression_suite = unittest.makeSuite(RegressionTests, "Check")
     return unittest.TestSuite((regression_suite,))
index ba6c770..bb37822 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
 [build_ext]
-define=
-include_dirs=/usr/include
-library_dirs=/usr/lib
+#define=
+#include_dirs=/usr/local/include
+#library_dirs=/usr/local/lib
 libraries=sqlite3
index 815595e..e2ee01a 100644 (file)
@@ -65,6 +65,7 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
     PyObject* class_attr = NULL;
     PyObject* class_attr_str = NULL;
     int is_apsw_connection = 0;
+    PyObject* database_utf8;
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|diOiOi", kwlist,
                                      &database, &timeout, &detect_types, &isolation_level, &check_same_thread, &factory, &cached_statements))
@@ -83,11 +84,23 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
     Py_INCREF(&PyUnicode_Type);
     self->text_factory = (PyObject*)&PyUnicode_Type;
 
-    if (PyString_Check(database)) {
+    if (PyString_Check(database) || PyUnicode_Check(database)) {
+        if (PyString_Check(database)) {
+            database_utf8 = database;
+            Py_INCREF(database_utf8);
+        } else {
+            database_utf8 = PyUnicode_AsUTF8String(database);
+            if (!database_utf8) {
+                return -1;
+            }
+        }
+
         Py_BEGIN_ALLOW_THREADS
-        rc = sqlite3_open(PyString_AsString(database), &self->db);
+        rc = sqlite3_open(PyString_AsString(database_utf8), &self->db);
         Py_END_ALLOW_THREADS
 
+        Py_DECREF(database_utf8);
+
         if (rc != SQLITE_OK) {
             _pysqlite_seterror(self->db, NULL);
             return -1;
index 13ab881..b14be2a 100644 (file)
@@ -25,7 +25,7 @@
 #define PYSQLITE_MODULE_H
 #include "Python.h"
 
-#define PYSQLITE_VERSION "2.4.0"
+#define PYSQLITE_VERSION "2.4.1"
 
 extern PyObject* pysqlite_Error;
 extern PyObject* pysqlite_Warning;