| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e209739 commit 0651583
31 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1723,7 +1723,7 @@ c_void_p_from_param(PyObject *type, PyObject *value) | |||
| 1723 | 1723 | if (stgd && CDataObject_Check(value) && stgd->proto && PyUnicode_Check(stgd->proto)) { | |
| 1724 | 1724 | PyCArgObject *parg; | |
| 1725 | 1725 | ||
| 1726 | - switch (_PyUnicode_AsString(stgd->proto)[0]) { | ||
| 1726 | + switch (PyUnicode_AsUTF8(stgd->proto)[0]) { | ||
| 1727 | 1727 | case 'z': /* c_char_p */ | |
| 1728 | 1728 | case 'Z': /* c_wchar_p */ | |
| 1729 | 1729 | parg = PyCArgObject_new(); | |
@@ -1835,7 +1835,7 @@ PyCSimpleType_paramfunc(CDataObject *self) | |||
| 1835 | 1835 | ||
| 1836 | 1836 | dict = PyObject_stgdict((PyObject *)self); | |
| 1837 | 1837 | assert(dict); /* Cannot be NULL for CDataObject instances */ | |
| 1838 | - fmt = _PyUnicode_AsString(dict->proto); | ||
| 1838 | + fmt = PyUnicode_AsUTF8(dict->proto); | ||
| 1839 | 1839 | assert(fmt); | |
| 1840 | 1840 | ||
| 1841 | 1841 | fd = _ctypes_get_fielddesc(fmt); | |
@@ -2059,7 +2059,7 @@ PyCSimpleType_from_param(PyObject *type, PyObject *value) | |||
| 2059 | 2059 | assert(dict); | |
| 2060 | 2060 | ||
| 2061 | 2061 | /* I think we can rely on this being a one-character string */ | |
| 2062 | - fmt = _PyUnicode_AsString(dict->proto); | ||
| 2062 | + fmt = PyUnicode_AsUTF8(dict->proto); | ||
| 2063 | 2063 | assert(fmt); | |
| 2064 | 2064 | ||
| 2065 | 2065 | fd = _ctypes_get_fielddesc(fmt); | |
@@ -3128,7 +3128,7 @@ _check_outarg_type(PyObject *arg, Py_ssize_t index) | |||
| 3128 | 3128 | /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ | |
| 3129 | 3129 | && PyUnicode_Check(dict->proto) | |
| 3130 | 3130 | /* We only allow c_void_p, c_char_p and c_wchar_p as a simple output parameter type */ | |
| 3131 | - && (strchr("PzZ", _PyUnicode_AsString(dict->proto)[0]))) { | ||
| 3131 | + && (strchr("PzZ", PyUnicode_AsUTF8(dict->proto)[0]))) { | ||
| 3132 | 3132 | return 1; | |
| 3133 | 3133 | } | |
| 3134 | 3134 | ||
@@ -3218,7 +3218,7 @@ _get_name(PyObject *obj, const char **pname) | |||
| 3218 | 3218 | return *pname ? 1 : 0; | |
| 3219 | 3219 | } | |
| 3220 | 3220 | if (PyUnicode_Check(obj)) { | |
| 3221 | - *pname = _PyUnicode_AsString(obj); | ||
| 3221 | + *pname = PyUnicode_AsUTF8(obj); | ||
| 3222 | 3222 | return *pname ? 1 : 0; | |
| 3223 | 3223 | } | |
| 3224 | 3224 | PyErr_SetString(PyExc_TypeError, | |
@@ -5233,7 +5233,7 @@ cast_check_pointertype(PyObject *arg) | |||
| 5233 | 5233 | dict = PyType_stgdict(arg); | |
| 5234 | 5234 | if (dict) { | |
| 5235 | 5235 | if (PyUnicode_Check(dict->proto) | |
| 5236 | - && (strchr("sPzUZXO", _PyUnicode_AsString(dict->proto)[0]))) { | ||
| 5236 | + && (strchr("sPzUZXO", PyUnicode_AsUTF8(dict->proto)[0]))) { | ||
| 5237 | 5237 | /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ | |
| 5238 | 5238 | return 1; | |
| 5239 | 5239 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -489,7 +489,7 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct | |||
| 489 | 489 | ||
| 490 | 490 | if (isStruct && !isPacked) { | |
| 491 | 491 | char *fieldfmt = dict->format ? dict->format : "B"; | |
| 492 | - char *fieldname = _PyUnicode_AsString(name); | ||
| 492 | + char *fieldname = PyUnicode_AsUTF8(name); | ||
| 493 | 493 | char *ptr; | |
| 494 | 494 | Py_ssize_t len; | |
| 495 | 495 | char *buf; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1219,7 +1219,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple, | |||
| 1219 | 1219 | assert(object && format && timetuple); | |
| 1220 | 1220 | assert(PyUnicode_Check(format)); | |
| 1221 | 1221 | /* Convert the input format to a C string and size */ | |
| 1222 | - pin = _PyUnicode_AsStringAndSize(format, &flen); | ||
| 1222 | + pin = PyUnicode_AsUTF8AndSize(format, &flen); | ||
| 1223 | 1223 | if (!pin) | |
| 1224 | 1224 | return NULL; | |
| 1225 | 1225 | ||
@@ -1287,7 +1287,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple, | |||
| 1287 | 1287 | } | |
| 1288 | 1288 | assert(Zreplacement != NULL); | |
| 1289 | 1289 | assert(PyUnicode_Check(Zreplacement)); | |
| 1290 | - ptoappend = _PyUnicode_AsStringAndSize(Zreplacement, | ||
| 1290 | + ptoappend = PyUnicode_AsUTF8AndSize(Zreplacement, | ||
| 1291 | 1291 | &ntoappend); | |
| 1292 | 1292 | if (ptoappend == NULL) | |
| 1293 | 1293 | goto Done; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -708,7 +708,7 @@ _io_StringIO___init___impl(stringio *self, PyObject *value, | |||
| 708 | 708 | Py_TYPE(newline_obj)->tp_name); | |
| 709 | 709 | return -1; | |
| 710 | 710 | } | |
| 711 | - newline = _PyUnicode_AsString(newline_obj); | ||
| 711 | + newline = PyUnicode_AsUTF8(newline_obj); | ||
| 712 | 712 | if (newline == NULL) | |
| 713 | 713 | return -1; | |
| 714 | 714 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -921,7 +921,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer, | |||
| 921 | 921 | Py_CLEAR(self->encoding); | |
| 922 | 922 | } | |
| 923 | 923 | if (self->encoding != NULL) { | |
| 924 | - encoding = _PyUnicode_AsString(self->encoding); | ||
| 924 | + encoding = PyUnicode_AsUTF8(self->encoding); | ||
| 925 | 925 | if (encoding == NULL) | |
| 926 | 926 | goto error; | |
| 927 | 927 | } | |
@@ -964,7 +964,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer, | |||
| 964 | 964 | } | |
| 965 | 965 | self->writetranslate = (newline == NULL || newline[0] != '\0'); | |
| 966 | 966 | if (!self->readuniversal && self->readnl) { | |
| 967 | - self->writenl = _PyUnicode_AsString(self->readnl); | ||
| 967 | + self->writenl = PyUnicode_AsUTF8(self->readnl); | ||
| 968 | 968 | if (self->writenl == NULL) | |
| 969 | 969 | goto error; | |
| 970 | 970 | if (!strcmp(self->writenl, "\n")) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1951,7 +1951,7 @@ save_long(PicklerObject *self, PyObject *obj) | |||
| 1951 | 1951 | if (repr == NULL) | |
| 1952 | 1952 | goto error; | |
| 1953 | 1953 | ||
| 1954 | - string = _PyUnicode_AsStringAndSize(repr, &size); | ||
| 1954 | + string = PyUnicode_AsUTF8AndSize(repr, &size); | ||
| 1955 | 1955 | if (string == NULL) | |
| 1956 | 1956 | goto error; | |
| 1957 | 1957 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -505,7 +505,7 @@ _pysqlite_set_result(sqlite3_context* context, PyObject* py_val) | |||
| 505 | 505 | } else if (PyFloat_Check(py_val)) { | |
| 506 | 506 | sqlite3_result_double(context, PyFloat_AsDouble(py_val)); | |
| 507 | 507 | } else if (PyUnicode_Check(py_val)) { | |
| 508 | - const char *str = _PyUnicode_AsString(py_val); | ||
| 508 | + const char *str = PyUnicode_AsUTF8(py_val); | ||
| 509 | 509 | if (str == NULL) | |
| 510 | 510 | return -1; | |
| 511 | 511 | sqlite3_result_text(context, str, -1, SQLITE_TRANSIENT); | |
@@ -1527,7 +1527,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args) | |||
| 1527 | 1527 | } | |
| 1528 | 1528 | } | |
| 1529 | 1529 | ||
| 1530 | - uppercase_name_str = _PyUnicode_AsString(uppercase_name); | ||
| 1530 | + uppercase_name_str = PyUnicode_AsUTF8(uppercase_name); | ||
| 1531 | 1531 | if (!uppercase_name_str) | |
| 1532 | 1532 | goto finally; | |
| 1533 | 1533 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -465,7 +465,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* | |||
| 465 | 465 | pysqlite_statement_reset(self->statement); | |
| 466 | 466 | } | |
| 467 | 467 | ||
| 468 | - operation_cstr = _PyUnicode_AsStringAndSize(operation, &operation_len); | ||
| 468 | + operation_cstr = PyUnicode_AsUTF8AndSize(operation, &operation_len); | ||
| 469 | 469 | if (operation_cstr == NULL) | |
| 470 | 470 | goto error; | |
| 471 | 471 | ||
@@ -689,7 +689,7 @@ PyObject* pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args) | |||
| 689 | 689 | self->reset = 0; | |
| 690 | 690 | ||
| 691 | 691 | if (PyUnicode_Check(script_obj)) { | |
| 692 | - script_cstr = _PyUnicode_AsString(script_obj); | ||
| 692 | + script_cstr = PyUnicode_AsUTF8(script_obj); | ||
| 693 | 693 | if (!script_cstr) { | |
| 694 | 694 | return NULL; | |
| 695 | 695 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -98,7 +98,7 @@ PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx) | |||
| 98 | 98 | Py_XINCREF(item); | |
| 99 | 99 | return item; | |
| 100 | 100 | } else if (PyUnicode_Check(idx)) { | |
| 101 | - key = _PyUnicode_AsString(idx); | ||
| 101 | + key = PyUnicode_AsUTF8(idx); | ||
| 102 | 102 | if (key == NULL) | |
| 103 | 103 | return NULL; | |
| 104 | 104 | ||
@@ -108,7 +108,7 @@ PyObject* pysqlite_row_subscript(pysqlite_Row* self, PyObject* idx) | |||
| 108 | 108 | PyObject *obj; | |
| 109 | 109 | obj = PyTuple_GET_ITEM(self->description, i); | |
| 110 | 110 | obj = PyTuple_GET_ITEM(obj, 0); | |
| 111 | - compare_key = _PyUnicode_AsString(obj); | ||
| 111 | + compare_key = PyUnicode_AsUTF8(obj); | ||
| 112 | 112 | if (!compare_key) { | |
| 113 | 113 | return NULL; | |
| 114 | 114 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,7 +59,7 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con | |||
| 59 | 59 | self->st = NULL; | |
| 60 | 60 | self->in_use = 0; | |
| 61 | 61 | ||
| 62 | - sql_cstr = _PyUnicode_AsStringAndSize(sql, &sql_cstr_len); | ||
| 62 | + sql_cstr = PyUnicode_AsUTF8AndSize(sql, &sql_cstr_len); | ||
| 63 | 63 | if (sql_cstr == NULL) { | |
| 64 | 64 | rc = PYSQLITE_SQL_WRONG_TYPE; | |
| 65 | 65 | return rc; | |
@@ -152,7 +152,7 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec | |||
| 152 | 152 | rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); | |
| 153 | 153 | break; | |
| 154 | 154 | case TYPE_UNICODE: | |
| 155 | - string = _PyUnicode_AsStringAndSize(parameter, &buflen); | ||
| 155 | + string = PyUnicode_AsUTF8AndSize(parameter, &buflen); | ||
| 156 | 156 | if (string == NULL) | |
| 157 | 157 | return -1; | |
| 158 | 158 | if (buflen > INT_MAX) { | |
@@ -325,7 +325,7 @@ int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params) | |||
| 325 | 325 | Py_ssize_t sql_len; | |
| 326 | 326 | sqlite3_stmt* new_st; | |
| 327 | 327 | ||
| 328 | - sql_cstr = _PyUnicode_AsStringAndSize(self->sql, &sql_len); | ||
| 328 | + sql_cstr = PyUnicode_AsUTF8AndSize(self->sql, &sql_len); | ||
| 329 | 329 | if (sql_cstr == NULL) { | |
| 330 | 330 | rc = PYSQLITE_SQL_WRONG_TYPE; | |
| 331 | 331 | return rc; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments