Skip to content

Commit 85bcb1b

Browse files
committed
Check that suggestion candidates in calculate_suggestions are strings.
1 parent 3929af5 commit 85bcb1b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Python/suggestions.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ _Py_CalculateSuggestions(PyObject *dir,
148148
}
149149
for (Py_ssize_t i = 0; i < dir_size; ++i) {
150150
PyObject *item = PyList_GET_ITEM(dir, i);
151+
if (!PyUnicode_Check(item)) {
152+
PyMem_Free(buffer);
153+
return NULL;
154+
}
151155
if (_PyUnicode_Equal(name, item)) {
152156
continue;
153157
}

0 commit comments

Comments
 (0)