mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-44655: Don't include suggestions for attributes that are the same as the missing one (GH-27197)
This commit is contained in:
parent
c90c591e51
commit
6714dec5e1
3 changed files with 17 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue