Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitebcc578

Browse files
authored
gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125583)
Replace PyUnicode_FromStringAndSize(NULL, 0)with Py_GetConstant(Py_CONSTANT_EMPTY_STR).
1 parentdb96327 commitebcc578

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

‎Modules/_datetimemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1766,7 +1766,7 @@ make_Zreplacement(PyObject *object, PyObject *tzinfoarg)
17661766
{
17671767
PyObject*temp;
17681768
PyObject*tzinfo=get_tzinfo_member(object);
1769-
PyObject*Zreplacement=PyUnicode_FromStringAndSize(NULL,0);
1769+
PyObject*Zreplacement=Py_GetConstant(Py_CONSTANT_EMPTY_STR);
17701770

17711771
if (Zreplacement==NULL)
17721772
returnNULL;

‎Modules/_io/textio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,7 @@ textiowrapper_get_decoded_chars(textio *self, Py_ssize_t n)
18061806
Py_ssize_tavail;
18071807

18081808
if (self->decoded_chars==NULL)
1809-
returnPyUnicode_FromStringAndSize(NULL,0);
1809+
returnPy_GetConstant(Py_CONSTANT_EMPTY_STR);
18101810

18111811
/* decoded_chars is guaranteed to be "ready". */
18121812
avail= (PyUnicode_GET_LENGTH(self->decoded_chars)

‎Modules/getpath.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ getpath_dirname(PyObject *Py_UNUSED(self), PyObject *args)
108108
Py_ssize_tend=PyUnicode_GET_LENGTH(path);
109109
Py_ssize_tpos=PyUnicode_FindChar(path,SEP,0,end,-1);
110110
if (pos<0) {
111-
returnPyUnicode_FromStringAndSize(NULL,0);
111+
returnPy_GetConstant(Py_CONSTANT_EMPTY_STR);
112112
}
113113
returnPyUnicode_Substring(path,0,pos);
114114
}
@@ -258,7 +258,7 @@ getpath_joinpath(PyObject *Py_UNUSED(self), PyObject *args)
258258
}
259259
Py_ssize_tn=PyTuple_GET_SIZE(args);
260260
if (n==0) {
261-
returnPyUnicode_FromStringAndSize(NULL,0);
261+
returnPy_GetConstant(Py_CONSTANT_EMPTY_STR);
262262
}
263263
/* Convert all parts to wchar and accumulate max final length */
264264
wchar_t**parts= (wchar_t**)PyMem_Malloc(n*sizeof(wchar_t*));
@@ -302,7 +302,7 @@ getpath_joinpath(PyObject *Py_UNUSED(self), PyObject *args)
302302
PyErr_NoMemory();
303303
returnNULL;
304304
}
305-
returnPyUnicode_FromStringAndSize(NULL,0);
305+
returnPy_GetConstant(Py_CONSTANT_EMPTY_STR);
306306
}
307307

308308
final[0]='\0';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp