Skip to content

Commit 7296598

Browse files
authored
gh-90699: Use _Py_STR(empty) instead of PyUnicode_New(0, 0) for BUILD_STRING (GH-91476)
1 parent b7f83bd commit 7296598

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Python/ceval.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3152,12 +3152,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
31523152

31533153
TARGET(BUILD_STRING) {
31543154
PyObject *str;
3155-
PyObject *empty = PyUnicode_New(0, 0);
3156-
if (empty == NULL) {
3157-
goto error;
3158-
}
3159-
str = _PyUnicode_JoinArray(empty, stack_pointer - oparg, oparg);
3160-
Py_DECREF(empty);
3155+
str = _PyUnicode_JoinArray(&_Py_STR(empty),
3156+
stack_pointer - oparg, oparg);
31613157
if (str == NULL)
31623158
goto error;
31633159
while (--oparg >= 0) {

0 commit comments

Comments
 (0)