when calculating the score, check the assignable from too, and return -1 if the check doesn't work.

This commit is contained in:
Mathieu Virbel 2012-08-20 11:09:02 +02:00
parent 79b564a338
commit 35ef6575d8
1 changed files with 5 additions and 2 deletions

View File

@ -169,8 +169,11 @@ cdef int calculate_score(sign_args, args) except *:
if jc.__javaclass__ == r:
score += 10
else:
# can be dangerous
score += 1
try:
check_assignable_from(jc, r)
except:
return -1
score += 5
continue
# always accept unknow object, but can be dangerous too.