Don't use deprecated function PyUnicode_GET_SIZE()
Replace it with PyUnicode_GET_LENGTH() or PyUnicode_AsUnicodeAndSize()
This commit is contained in:
parent
e223439c13
commit
59799a8399
|
@ -3461,7 +3461,7 @@ xmlparser_parse_whole(XMLParserObject* self, PyObject* args)
|
||||||
|
|
||||||
if (PyUnicode_CheckExact(buffer)) {
|
if (PyUnicode_CheckExact(buffer)) {
|
||||||
/* A unicode object is encoded into bytes using UTF-8 */
|
/* A unicode object is encoded into bytes using UTF-8 */
|
||||||
if (PyUnicode_GET_SIZE(buffer) == 0) {
|
if (PyUnicode_GET_LENGTH(buffer) == 0) {
|
||||||
Py_DECREF(buffer);
|
Py_DECREF(buffer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -829,15 +829,14 @@ path_converter(PyObject *o, void *p) {
|
||||||
if (unicode) {
|
if (unicode) {
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
wchar_t *wide;
|
wchar_t *wide;
|
||||||
length = PyUnicode_GET_SIZE(unicode);
|
|
||||||
if (length > 32767) {
|
wide = PyUnicode_AsUnicodeAndSize(unicode, &length);
|
||||||
FORMAT_EXCEPTION(PyExc_ValueError, "%s too long for Windows");
|
if (!wide) {
|
||||||
Py_DECREF(unicode);
|
Py_DECREF(unicode);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (length > 32767) {
|
||||||
wide = PyUnicode_AsUnicode(unicode);
|
FORMAT_EXCEPTION(PyExc_ValueError, "%s too long for Windows");
|
||||||
if (!wide) {
|
|
||||||
Py_DECREF(unicode);
|
Py_DECREF(unicode);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ namespace_repr(PyObject *ns)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
while ((key = PyIter_Next(keys_iter)) != NULL) {
|
while ((key = PyIter_Next(keys_iter)) != NULL) {
|
||||||
if (PyUnicode_Check(key) && PyUnicode_GET_SIZE(key) > 0) {
|
if (PyUnicode_Check(key) && PyUnicode_GET_LENGTH(key) > 0) {
|
||||||
PyObject *value, *item;
|
PyObject *value, *item;
|
||||||
|
|
||||||
value = PyDict_GetItem(d, key);
|
value = PyDict_GetItem(d, key);
|
||||||
|
|
Loading…
Reference in New Issue