mp_obj_is_callable(): Only object types can be callable.

Fixes segfault on callable("string").
This commit is contained in:
Paul Sokolovsky 2014-01-23 03:24:53 +02:00
parent bc5b3f8c73
commit c3e72a8cc8
2 changed files with 6 additions and 1 deletions

View File

@ -66,7 +66,7 @@ void mp_obj_print_exception(mp_obj_t exc) {
}
bool mp_obj_is_callable(mp_obj_t o_in) {
if (MP_OBJ_IS_SMALL_INT(o_in)) {
if (!MP_OBJ_IS_OBJ(o_in)) {
return false;
} else {
mp_obj_base_t *o = o_in;

View File

@ -0,0 +1,5 @@
import sys
print(callable(1))
print(callable("dfsd"))
print(callable(callable))
print(callable(sys))