[pypy-commit] pypy annotator: move handling of _flowspace_rewrite_directly_as_ to const()
rlamy
noreply at buildbot.pypy.org
Fri Jan 17 18:36:52 CET 2014
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: annotator
Changeset: r68745:e3fc10934126
Date: 2014-01-17 16:52 +0000
http://bitbucket.org/pypy/pypy/changeset/e3fc10934126/
Log: move handling of _flowspace_rewrite_directly_as_ to const()
diff --git a/rpython/flowspace/model.py b/rpython/flowspace/model.py
--- a/rpython/flowspace/model.py
+++ b/rpython/flowspace/model.py
@@ -400,6 +400,8 @@
type_with_bad_introspection = type(complex.real.__get__)
def const(obj):
+ if hasattr(obj, "_flowspace_rewrite_directly_as_"):
+ obj = obj._flowspace_rewrite_directly_as_
if isinstance(obj, (Variable, Constant)):
raise TypeError("already wrapped: " + repr(obj))
# method-wrapper have ill-defined comparison and introspection
diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -48,9 +48,6 @@
def call(self, w_callable, args):
if isinstance(w_callable, Constant):
fn = w_callable.value
- if hasattr(fn, "_flowspace_rewrite_directly_as_"):
- fn = fn._flowspace_rewrite_directly_as_
- w_callable = const(fn)
try:
sc = SPECIAL_CASES[fn] # TypeError if 'fn' not hashable
except (KeyError, TypeError):
More information about the pypy-commit
mailing list