diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-09 04:58:54 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-09 04:58:54 (GMT) |
commit | dd96db63f689e2f0d8ae5a1436b3b3395eec7de5 (patch) | |
tree | b2299acac9ce44fc488fc7b2ae2a44548cd5fbb8 /Modules/_sqlite/statement.c | |
parent | e98839a1f48b2915f1cc747884e64f4d6e4c8e7a (diff) | |
download | cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.zip cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.gz cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.bz2 |
This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r-- | Modules/_sqlite/statement.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index b9245f7..0e77668 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -60,7 +60,7 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con self->st = NULL; self->in_use = 0; - if (PyBytes_Check(sql)) { + if (PyString_Check(sql)) { sql_str = sql; Py_INCREF(sql_str); } else if (PyUnicode_Check(sql)) { @@ -77,7 +77,7 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con self->in_weakreflist = NULL; self->sql = sql_str; - sql_cstr = PyBytes_AsString(sql_str); + sql_cstr = PyString_AsString(sql_str); rc = sqlite3_prepare(connection->db, sql_cstr, @@ -119,7 +119,7 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec paramtype = TYPE_LONG; } else if (PyFloat_CheckExact(parameter)) { paramtype = TYPE_FLOAT; - } else if (PyBytes_CheckExact(parameter)) { + } else if (PyString_CheckExact(parameter)) { paramtype = TYPE_STRING; } else if (PyUnicode_CheckExact(parameter)) { paramtype = TYPE_UNICODE; @@ -131,7 +131,7 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec paramtype = TYPE_LONG; } else if (PyFloat_Check(parameter)) { paramtype = TYPE_FLOAT; - } else if (PyBytes_Check(parameter)) { + } else if (PyString_Check(parameter)) { paramtype = TYPE_STRING; } else if (PyUnicode_Check(parameter)) { paramtype = TYPE_UNICODE; @@ -140,7 +140,7 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec } if (paramtype == TYPE_STRING && !allow_8bit_chars) { - string = PyBytes_AS_STRING(parameter); + string = PyString_AS_STRING(parameter); for (c = string; *c != 0; c++) { if (*c & 0x80) { PyErr_SetString(pysqlite_ProgrammingError, "You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings."); @@ -164,12 +164,12 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); break; case TYPE_STRING: - string = PyBytes_AS_STRING(parameter); + string = PyString_AS_STRING(parameter); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); break; case TYPE_UNICODE: stringval = PyUnicode_AsUTF8String(parameter); - string = PyBytes_AsString(stringval); + string = PyString_AsString(stringval); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); Py_DECREF(stringval); break; @@ -197,7 +197,7 @@ static int _need_adapt(PyObject* obj) } if (PyInt_CheckExact(obj) || PyLong_CheckExact(obj) - || PyFloat_CheckExact(obj) || PyBytes_CheckExact(obj) + || PyFloat_CheckExact(obj) || PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || PyBuffer_Check(obj)) { return 0; } else { @@ -326,7 +326,7 @@ int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params) char* sql_cstr; sqlite3_stmt* new_st; - sql_cstr = PyBytes_AsString(self->sql); + sql_cstr = PyString_AsString(self->sql); rc = sqlite3_prepare(self->db, sql_cstr, |