Mercurial > cpython-lru_cache-weakref
diff Modules/_sqlite/cursor.c @ 74850:0fc10a33eb4c
Undocument and clean up sqlite3.OptimizedUnicode
Closes #13921.
| author | Petri Lehtinen <petri@digip.org> |
|---|---|
| date | Thu, 09 Feb 2012 21:09:03 +0200 |
| parents | 630dfddab73c |
| children | c5fb8bc56def |
line wrap: on
line diff
--- a/Modules/_sqlite/cursor.c Thu Feb 09 18:27:48 2012 +0800 +++ b/Modules/_sqlite/cursor.c Thu Feb 09 21:09:03 2012 +0200 @@ -267,11 +267,6 @@ } } -PyObject* pysqlite_unicode_from_string(const char* val_str, Py_ssize_t size, int optimize) -{ - return PyUnicode_FromStringAndSize(val_str, size); -} - /* * Returns a row from the currently active SQLite statement * @@ -355,12 +350,8 @@ } else if (coltype == SQLITE_TEXT) { val_str = (const char*)sqlite3_column_text(self->statement->st, i); nbytes = sqlite3_column_bytes(self->statement->st, i); - if ((self->connection->text_factory == (PyObject*)&PyUnicode_Type) - || (self->connection->text_factory == pysqlite_OptimizedUnicode)) { - - converted = pysqlite_unicode_from_string(val_str, nbytes, - self->connection->text_factory == pysqlite_OptimizedUnicode ? 1 : 0); - + if (self->connection->text_factory == (PyObject*)&PyUnicode_Type) { + converted = PyUnicode_FromStringAndSize(val_str, nbytes); if (!converted) { colname = sqlite3_column_name(self->statement->st, i); if (!colname) { @@ -459,7 +450,6 @@ int statement_type; PyObject* descriptor; PyObject* second_argument = NULL; - int allow_8bit_chars; if (!check_cursor(self)) { goto error; @@ -468,10 +458,6 @@ self->locked = 1; self->reset = 0; - /* Make shooting yourself in the foot with not utf-8 decodable 8-bit-strings harder */ - allow_8bit_chars = ((self->connection->text_factory != (PyObject*)&PyUnicode_Type) && - (self->connection->text_factory != pysqlite_OptimizedUnicode)); - Py_XDECREF(self->next_row); self->next_row = NULL; @@ -630,7 +616,7 @@ pysqlite_statement_mark_dirty(self->statement); - pysqlite_statement_bind_parameters(self->statement, parameters, allow_8bit_chars); + pysqlite_statement_bind_parameters(self->statement, parameters); if (PyErr_Occurred()) { goto error; }
