summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-11 03:12:36 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-11 03:33:19 +0300
commit9511f60f016547ab00f634d451c230351bd8b225 (patch)
treec4bb8fcc41a0d63f1434943b8b9134c292666b43 /py
parent69f3eb2c9688752d674254c3f4158cae688053be (diff)
downloadmicropython-9511f60f016547ab00f634d451c230351bd8b225.tar.gz
micropython-9511f60f016547ab00f634d451c230351bd8b225.zip
py: Don't try to "bind" types store as attributes of objects.
This was hit when trying to make urlparse.py from stdlib run. Took quite some time to debug. TODO: Reconsile bound method creation process better, maybe callable is to generic type to bind at all?
Diffstat (limited to 'py')
-rw-r--r--py/objtype.c3
-rw-r--r--py/runtime.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/py/objtype.c b/py/objtype.c
index 345eee7140..ef5f6b9d9c 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -333,6 +333,9 @@ STATIC void instance_convert_return_attr(mp_obj_t self, mp_obj_t member, mp_obj_
// return a bound method, with self being the type of this object
dest[0] = ((mp_obj_static_class_method_t*)member)->fun;
dest[1] = mp_obj_get_type(self);
+ } else if (MP_OBJ_IS_TYPE(member, &mp_type_type)) {
+ // Don't try to bind types
+ dest[0] = member;
} else if (mp_obj_is_callable(member)) {
// return a bound method, with self being this object
dest[0] = member;
diff --git a/py/runtime.c b/py/runtime.c
index 1479d8cba3..a2de2d75b1 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -840,6 +840,9 @@ void mp_load_method_maybe(mp_obj_t base, qstr attr, mp_obj_t *dest) {
// return a bound method, with self being the type of this object
dest[0] = ((mp_obj_static_class_method_t*)elem->value)->fun;
dest[1] = mp_obj_get_type(base);
+ } else if (MP_OBJ_IS_TYPE(elem->value, &mp_type_type)) {
+ // Don't try to bind types
+ dest[0] = elem->value;
} else if (mp_obj_is_callable(elem->value)) {
// return a bound method, with self being this object
dest[0] = elem->value;