mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Renamed PyBytes to PyByteArray
This commit is contained in:
parent
96d02f3c1e
commit
9c4756ea26
31 changed files with 397 additions and 397 deletions
|
@ -352,7 +352,7 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
|
|||
}
|
||||
PyOS_snprintf(buf, sizeof(buf) - 1, "Could not decode to UTF-8 column '%s' with text '%s'",
|
||||
colname , val_str);
|
||||
buf_bytes = PyBytes_FromStringAndSize(buf, strlen(buf));
|
||||
buf_bytes = PyByteArray_FromStringAndSize(buf, strlen(buf));
|
||||
if (!buf_bytes) {
|
||||
PyErr_SetString(pysqlite_OperationalError, "Could not decode to UTF-8");
|
||||
} else {
|
||||
|
@ -368,8 +368,8 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
|
|||
}
|
||||
} else if (self->connection->text_factory == (PyObject*)&PyString_Type) {
|
||||
converted = PyString_FromString(val_str);
|
||||
} else if (self->connection->text_factory == (PyObject*)&PyBytes_Type) {
|
||||
converted = PyBytes_FromStringAndSize(val_str, strlen(val_str));
|
||||
} else if (self->connection->text_factory == (PyObject*)&PyByteArray_Type) {
|
||||
converted = PyByteArray_FromStringAndSize(val_str, strlen(val_str));
|
||||
} else {
|
||||
converted = PyObject_CallFunction(self->connection->text_factory, "y", val_str);
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ static PyObject* module_register_adapter(PyObject* self, PyObject* args, PyObjec
|
|||
/* a basic type is adapted; there's a performance optimization if that's not the case
|
||||
* (99 % of all usages) */
|
||||
if (type == &PyLong_Type || type == &PyFloat_Type
|
||||
|| type == &PyUnicode_Type || type == &PyBytes_Type) {
|
||||
|| type == &PyUnicode_Type || type == &PyByteArray_Type) {
|
||||
pysqlite_BaseTypeAdapted = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ static int _need_adapt(PyObject* obj)
|
|||
}
|
||||
|
||||
if (PyLong_CheckExact(obj) || PyFloat_CheckExact(obj)
|
||||
|| PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
|
||||
|| PyUnicode_CheckExact(obj) || PyByteArray_CheckExact(obj)) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue