mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Rename PyUnicode_AsString -> _PyUnicode_AsString and
PyUnicode_AsStringAndSize -> _PyUnicode_AsStringAndSize to mark them for interpreter internal use only. We'll have to rework these APIs or create new ones for the purpose of accessing the UTF-8 representation of Unicode objects for 3.1.
This commit is contained in:
parent
28bd1a3bd5
commit
4cc0f24857
60 changed files with 156 additions and 137 deletions
|
|
@ -434,7 +434,7 @@ void _pysqlite_set_result(sqlite3_context* context, PyObject* py_val)
|
|||
} else if (PyFloat_Check(py_val)) {
|
||||
sqlite3_result_double(context, PyFloat_AsDouble(py_val));
|
||||
} else if (PyUnicode_Check(py_val)) {
|
||||
sqlite3_result_text(context, PyUnicode_AsString(py_val), -1, SQLITE_TRANSIENT);
|
||||
sqlite3_result_text(context, _PyUnicode_AsString(py_val), -1, SQLITE_TRANSIENT);
|
||||
} else if (PyObject_CheckBuffer(py_val)) {
|
||||
if (PyObject_AsCharBuffer(py_val, &buffer, &buflen) != 0) {
|
||||
PyErr_SetString(PyExc_ValueError, "could not convert BLOB to buffer");
|
||||
|
|
@ -901,7 +901,7 @@ static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, Py
|
|||
return -1;
|
||||
}
|
||||
|
||||
statement = PyUnicode_AsStringAndSize(begin_statement, &size);
|
||||
statement = _PyUnicode_AsStringAndSize(begin_statement, &size);
|
||||
if (!statement) {
|
||||
Py_DECREF(statement);
|
||||
return -1;
|
||||
|
|
@ -1194,7 +1194,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
|
|||
goto finally;
|
||||
}
|
||||
|
||||
chk = PyUnicode_AsString(uppercase_name);
|
||||
chk = _PyUnicode_AsString(uppercase_name);
|
||||
while (*chk) {
|
||||
if ((*chk >= '0' && *chk <= '9')
|
||||
|| (*chk >= 'A' && *chk <= 'Z')
|
||||
|
|
@ -1219,7 +1219,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
|
|||
}
|
||||
|
||||
rc = sqlite3_create_collation(self->db,
|
||||
PyUnicode_AsString(uppercase_name),
|
||||
_PyUnicode_AsString(uppercase_name),
|
||||
SQLITE_UTF8,
|
||||
(callable != Py_None) ? callable : NULL,
|
||||
(callable != Py_None) ? pysqlite_collation_callback : NULL);
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
|
|||
rc = pysqlite_statement_reset(self->statement);
|
||||
}
|
||||
|
||||
operation_cstr = PyUnicode_AsStringAndSize(operation, &operation_len);
|
||||
operation_cstr = _PyUnicode_AsStringAndSize(operation, &operation_len);
|
||||
if (operation == NULL)
|
||||
goto error;
|
||||
|
||||
|
|
@ -793,7 +793,7 @@ PyObject* pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
|
|||
}
|
||||
|
||||
if (PyUnicode_Check(script_obj)) {
|
||||
script_cstr = PyUnicode_AsString(script_obj);
|
||||
script_cstr = _PyUnicode_AsString(script_obj);
|
||||
if (!script_cstr) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,12 +82,12 @@ PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx)
|
|||
Py_XINCREF(item);
|
||||
return item;
|
||||
} else if (PyUnicode_Check(idx)) {
|
||||
key = PyUnicode_AsString(idx);
|
||||
key = _PyUnicode_AsString(idx);
|
||||
|
||||
nitems = PyTuple_Size(self->description);
|
||||
|
||||
for (i = 0; i < nitems; i++) {
|
||||
compare_key = PyUnicode_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0));
|
||||
compare_key = _PyUnicode_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0));
|
||||
if (!compare_key) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con
|
|||
self->st = NULL;
|
||||
self->in_use = 0;
|
||||
|
||||
sql_cstr = PyUnicode_AsStringAndSize(sql, &sql_cstr_len);
|
||||
sql_cstr = _PyUnicode_AsStringAndSize(sql, &sql_cstr_len);
|
||||
if (sql_cstr == NULL) {
|
||||
rc = PYSQLITE_SQL_WRONG_TYPE;
|
||||
return rc;
|
||||
|
|
@ -140,7 +140,7 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec
|
|||
rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter));
|
||||
break;
|
||||
case TYPE_UNICODE:
|
||||
string = PyUnicode_AsString(parameter);
|
||||
string = _PyUnicode_AsString(parameter);
|
||||
rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT);
|
||||
break;
|
||||
case TYPE_BUFFER:
|
||||
|
|
@ -296,7 +296,7 @@ int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params)
|
|||
Py_ssize_t sql_len;
|
||||
sqlite3_stmt* new_st;
|
||||
|
||||
sql_cstr = PyUnicode_AsStringAndSize(self->sql, &sql_len);
|
||||
sql_cstr = _PyUnicode_AsStringAndSize(self->sql, &sql_len);
|
||||
if (sql_cstr == NULL) {
|
||||
rc = PYSQLITE_SQL_WRONG_TYPE;
|
||||
return rc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue