diff options
author | Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com> | 2021-04-27 00:22:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 00:22:27 (GMT) |
commit | 284c52da092438522949d6f96d8c1f9ff37f9f00 (patch) | |
tree | 8bbd5d4c0b4e396dd27f52b94f94e5c90b9e97f6 /Python/suggestions.c | |
parent | 7244c0060dc3ef909f34b0791c3e7490b0340d5e (diff) | |
download | cpython-284c52da092438522949d6f96d8c1f9ff37f9f00.zip cpython-284c52da092438522949d6f96d8c1f9ff37f9f00.tar.gz cpython-284c52da092438522949d6f96d8c1f9ff37f9f00.tar.bz2 |
bpo-38530: Require 50% similarity in NameError and AttributeError suggestions (GH-25584)
Diffstat (limited to 'Python/suggestions.c')
-rw-r--r-- | Python/suggestions.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/suggestions.c b/Python/suggestions.c index d4e9dc2..2fd6714 100644 --- a/Python/suggestions.c +++ b/Python/suggestions.c @@ -102,7 +102,10 @@ calculate_suggestions(PyObject *dir, if (current_distance == -1) { return NULL; } - if (current_distance == 0 || current_distance > MAX_DISTANCE) { + if (current_distance == 0 || + current_distance > MAX_DISTANCE || + current_distance * 2 > name_size) + { continue; } if (!suggestion || current_distance < suggestion_distance) { |