mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
(Merge 3.3) Issue #20026: Fix the sqlite module to handle correctly invalid
isolation level (wrong type).
This commit is contained in:
commit
08263f10f8
3 changed files with 12 additions and 1 deletions
|
@ -330,6 +330,11 @@ class RegressionTests(unittest.TestCase):
|
||||||
datetime.datetime(2012, 4, 4, 15, 6, 0, 123456),
|
datetime.datetime(2012, 4, 4, 15, 6, 0, 123456),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def CheckInvalidIsolationLevelType(self):
|
||||||
|
# isolation level is a string, not an integer
|
||||||
|
self.assertRaises(TypeError,
|
||||||
|
sqlite.connect, ":memory:", isolation_level=123)
|
||||||
|
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
regression_suite = unittest.makeSuite(RegressionTests, "Check")
|
regression_suite = unittest.makeSuite(RegressionTests, "Check")
|
||||||
|
|
|
@ -44,6 +44,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #20026: Fix the sqlite module to handle correctly invalid isolation
|
||||||
|
level (wrong type).
|
||||||
|
|
||||||
- Issue #18829: csv.Dialect() now checks type for delimiter, escapechar and
|
- Issue #18829: csv.Dialect() now checks type for delimiter, escapechar and
|
||||||
quotechar fields. Original patch by Vajrasky Kok.
|
quotechar fields. Original patch by Vajrasky Kok.
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,10 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
|
||||||
Py_INCREF(isolation_level);
|
Py_INCREF(isolation_level);
|
||||||
}
|
}
|
||||||
self->isolation_level = NULL;
|
self->isolation_level = NULL;
|
||||||
pysqlite_connection_set_isolation_level(self, isolation_level);
|
if (pysqlite_connection_set_isolation_level(self, isolation_level) < 0) {
|
||||||
|
Py_DECREF(isolation_level);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
Py_DECREF(isolation_level);
|
Py_DECREF(isolation_level);
|
||||||
|
|
||||||
self->statement_cache = (pysqlite_Cache*)PyObject_CallFunction((PyObject*)&pysqlite_CacheType, "Oi", self, cached_statements);
|
self->statement_cache = (pysqlite_Cache*)PyObject_CallFunction((PyObject*)&pysqlite_CacheType, "Oi", self, cached_statements);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue