summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-16 21:16:08 (GMT)
committerGitHub <noreply@github.com>2021-07-16 21:16:08 (GMT)
commita0b1d401db52391d13479c53ee3880e6640df98c (patch)
tree72785b3d5075acf2f51228c8a2534adeadb8a891 /Python
parent42a5514cca6b4542f6b492b5652e337f15a89227 (diff)
downloadcpython-a0b1d401db52391d13479c53ee3880e6640df98c.zip
cpython-a0b1d401db52391d13479c53ee3880e6640df98c.tar.gz
cpython-a0b1d401db52391d13479c53ee3880e6640df98c.tar.bz2
bpo-44655: Don't include suggestions for attributes that are the same as the missing one (GH-27197) (GH-27198)
(cherry picked from commit 6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Python')
-rw-r--r--Python/suggestions.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/suggestions.c b/Python/suggestions.c
index 6fb01f1..7fd62fb 100644
--- a/Python/suggestions.c
+++ b/Python/suggestions.c
@@ -149,6 +149,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.