Commit 169b458c authored by Stefan Behnel's avatar Stefan Behnel

minor code cleanups

parent 13fb4423
...@@ -4079,13 +4079,13 @@ def best_match(args, functions, pos=None, env=None): ...@@ -4079,13 +4079,13 @@ def best_match(args, functions, pos=None, env=None):
assignable = dst_type.assignable_from(c_src_type) assignable = dst_type.assignable_from(c_src_type)
if assignable: if assignable:
src_type = c_src_type src_type = c_src_type
needed_coercions[func] = i, dst_type needed_coercions[func] = (i, dst_type)
if assignable: if assignable:
if src_type == dst_type or dst_type.same_as(src_type): if src_type == dst_type or dst_type.same_as(src_type):
pass # score 0 pass # score 0
elif func_type.is_strict_signature: elif func_type.is_strict_signature:
break # exact match requested but not found break # exact match requested but not found
elif is_promotion(src_type, dst_type): elif is_promotion(src_type, dst_type):
score[2] += 1 score[2] += 1
elif ((src_type.is_int and dst_type.is_int) or elif ((src_type.is_int and dst_type.is_int) or
...@@ -4097,12 +4097,11 @@ def best_match(args, functions, pos=None, env=None): ...@@ -4097,12 +4097,11 @@ def best_match(args, functions, pos=None, env=None):
else: else:
score[0] += 1 score[0] += 1
else: else:
error_mesg = "Invalid conversion from '%s' to '%s'"%(src_type, error_mesg = "Invalid conversion from '%s' to '%s'" % (src_type, dst_type)
dst_type)
bad_types.append((func, error_mesg)) bad_types.append((func, error_mesg))
break break
else: else:
possibilities.append((score, index, func)) # so we can sort it possibilities.append((score, index, func)) # so we can sort it
if possibilities: if possibilities:
possibilities.sort() possibilities.sort()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment