From 284c52da092438522949d6f96d8c1f9ff37f9f00 Mon Sep 17 00:00:00 2001 From: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com> Date: Mon, 26 Apr 2021 20:22:27 -0400 Subject: bpo-38530: Require 50% similarity in NameError and AttributeError suggestions (GH-25584) --- Python/suggestions.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Python') diff --git a/Python/suggestions.c b/Python/suggestions.c index d4e9dc22bb..2fd6714e84 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) { -- cgit v1.2.1