mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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
3 changed files with 7 additions and 8 deletions
|
@ -829,15 +829,14 @@ path_converter(PyObject *o, void *p) {
|
|||
if (unicode) {
|
||||
#ifdef MS_WINDOWS
|
||||
wchar_t *wide;
|
||||
length = PyUnicode_GET_SIZE(unicode);
|
||||
if (length > 32767) {
|
||||
FORMAT_EXCEPTION(PyExc_ValueError, "%s too long for Windows");
|
||||
|
||||
wide = PyUnicode_AsUnicodeAndSize(unicode, &length);
|
||||
if (!wide) {
|
||||
Py_DECREF(unicode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
wide = PyUnicode_AsUnicode(unicode);
|
||||
if (!wide) {
|
||||
if (length > 32767) {
|
||||
FORMAT_EXCEPTION(PyExc_ValueError, "%s too long for Windows");
|
||||
Py_DECREF(unicode);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue