Author: Carl Friedrich Bolz <[email protected]>
Branch: guard-compatible
Changeset: r85130:febecdcd73b2
Date: 2016-06-13 15:50 +0200
http://bitbucket.org/pypy/pypy/changeset/febecdcd73b2/
Log: merge
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)
diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py
--- a/rpython/rlib/jit.py
+++ b/rpython/rlib/jit.py
@@ -1,4 +1,5 @@
import sys
+import random
import py
@@ -381,7 +382,9 @@
def we_are_jitted():
""" Considered as true during tracing and blackholing,
so its consquences are reflected into jitted code """
- return False
+ # during testing we return something randomly, to emulate the real
+ # behaviour where you can switch to tracing a arbitrary points.
+ return random.random() > 0.5
_we_are_jitted = CDefinedIntSymbolic('0 /* we are not jitted here */',
default=0)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit