We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77f9de1 commit dee788bCopy full SHA for dee788b
Python/suggestions.c
@@ -333,9 +333,15 @@ offer_suggestions_for_import_error(PyImportErrorObject *exc)
333
return NULL;
334
}
335
336
- PyObject *suggestions = calculate_suggestions(dir, name);
+ PyObject *suggestion = calculate_suggestions(dir, name);
337
Py_DECREF(dir);
338
- return suggestions;
+ if (!suggestion) {
339
+ return NULL;
340
+ }
341
+
342
+ PyObject* result = PyUnicode_FromFormat(". Did you mean: %R?", suggestion);
343
+ Py_DECREF(suggestion);
344
+ return result;
345
346
347
// Offer suggestions for a given exception. Returns a python string object containing the
0 commit comments