Author: Carl Friedrich Bolz <[email protected]>
Branch: guard-compatible
Changeset: r85128:4d70d977e2f2
Date: 2016-05-24 10:57 +0200
http://bitbucket.org/pypy/pypy/changeset/4d70d977e2f2/
Log: deal with TypeErrors in we_are_jitted() blocks correctly
diff --git a/pypy/objspace/std/callmethod.py b/pypy/objspace/std/callmethod.py
--- a/pypy/objspace/std/callmethod.py
+++ b/pypy/objspace/std/callmethod.py
@@ -48,11 +48,15 @@
name = None
if jit.we_are_jitted():
# compute safeness without reading the type
- map = w_obj._get_mapdict_map_no_promote()
- if map is not None and map._type_safe_to_do_getattr():
- safe = True
- name = space.str_w(w_name)
- w_descr = map._type_lookup_safe(name)
+ try:
+ map = w_obj._get_mapdict_map_no_promote()
+ except TypeError:
+ pass
+ else:
+ if map._type_safe_to_do_getattr():
+ safe = True
+ name = space.str_w(w_name)
+ w_descr = map._type_lookup_safe(name)
else:
w_type = space.type(w_obj)
safe = w_type.has_object_getattribute()
@@ -143,10 +147,14 @@
w_descr = None
if jit.we_are_jitted():
# compute safeness without reading the type
- map = w_obj._get_mapdict_map_no_promote()
- if map is not None and map._type_safe_to_do_getattr():
- safe = True
- w_descr = map._type_lookup_safe(methname)
+ try:
+ map = w_obj._get_mapdict_map_no_promote()
+ except TypeError:
+ pass
+ else:
+ if map._type_safe_to_do_getattr():
+ safe = True
+ w_descr = map._type_lookup_safe(methname)
else:
w_type = space.type(w_obj)
safe = w_type.has_object_getattribute()
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -535,11 +535,15 @@
safe = False
if jit.we_are_jitted():
# compute safeness without reading the type
- map = w_obj._get_mapdict_map_no_promote()
- if map is not None and map._type_safe_to_do_getattr():
- safe = True
- name = self.str_w(w_name)
- w_descr = map._type_lookup_safe(name)
+ try:
+ map = w_obj._get_mapdict_map_no_promote()
+ except TypeError:
+ pass
+ else:
+ if map._type_safe_to_do_getattr():
+ safe = True
+ name = self.str_w(w_name)
+ w_descr = map._type_lookup_safe(name)
if not safe:
w_type = self.type(w_obj)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit