Skip to content

Commit dee788b

Browse files
committed
Update with latest code
Signed-off-by: Pablo Galindo <[email protected]>
1 parent 77f9de1 commit dee788b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎Python/suggestions.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,15 @@ offer_suggestions_for_import_error(PyImportErrorObject *exc)
333333
return NULL;
334334
}
335335

336-
PyObject *suggestions = calculate_suggestions(dir, name);
336+
PyObject *suggestion = calculate_suggestions(dir, name);
337337
Py_DECREF(dir);
338-
return suggestions;
338+
if (!suggestion) {
339+
return NULL;
340+
}
341+
342+
PyObject* result = PyUnicode_FromFormat(". Did you mean: %R?", suggestion);
343+
Py_DECREF(suggestion);
344+
return result;
339345
}
340346

341347
// Offer suggestions for a given exception. Returns a python string object containing the

0 commit comments

Comments
 (0)