summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-07-16 20:58:21 (GMT)
committerGitHub <noreply@github.com>2021-07-16 20:58:21 (GMT)
commit6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d (patch)
treeb243c5db97cf18198e8a080e400edd9b06c34f03 /Python
parentc90c591e5158ab7b531dcd6e2a5f00bc70ba7637 (diff)
downloadcpython-6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d.zip
cpython-6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d.tar.gz
cpython-6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d.tar.bz2
bpo-44655: Don't include suggestions for attributes that are the same as the missing one (GH-27197)
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 3dfcbfe..77bdb6c 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.