From 6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Fri, 16 Jul 2021 21:58:21 +0100 Subject: bpo-44655: Don't include suggestions for attributes that are the same as the missing one (GH-27197) --- Python/suggestions.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Python') diff --git a/Python/suggestions.c b/Python/suggestions.c index 3dfcbfe3ab..77bdb6c165 100644 --- a/Python/suggestions.c +++ b/Python/suggestions.c @@ -151,6 +151,9 @@ calculate_suggestions(PyObject *dir, if (item_str == NULL) { return NULL; } + if (PyUnicode_CompareWithASCIIString(name, item_str) == 0) { + continue; + } // No more than 1/3 of the involved characters should need changed. Py_ssize_t max_distance = (name_size + item_size + 3) * MOVE_COST / 6; // Don't take matches we've already beaten. -- cgit v1.2.1