Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: Changeset: r47672:7fbfa277383f Date: 2011-09-29 10:34 +0200 http://bitbucket.org/pypy/pypy/changeset/7fbfa277383f/
Log: rename to is_annotation_constant. add a docstring. 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 @@ -7,7 +7,7 @@ from pypy.objspace.std import (builtinshortcut, stdtypedef, frame, model, transparent, callmethod, proxyobject) from pypy.objspace.descroperation import DescrOperation, raiseattrerror -from pypy.rlib.objectmodel import instantiate, r_dict, specialize, is_constant +from pypy.rlib.objectmodel import instantiate, r_dict, specialize, is_annotation_constant from pypy.rlib.debug import make_sure_not_resized from pypy.rlib.rarithmetic import base_int, widen from pypy.rlib.objectmodel import we_are_translated @@ -578,7 +578,7 @@ if not isinstance(w_type, W_TypeObject): raise OperationError(self.w_TypeError, self.wrap("need type object")) - if is_constant(w_type): + if is_annotation_constant(w_type): cls = w_type.interplevel_cls if cls is not None: assert w_inst is not None diff --git a/pypy/rlib/objectmodel.py b/pypy/rlib/objectmodel.py --- a/pypy/rlib/objectmodel.py +++ b/pypy/rlib/objectmodel.py @@ -176,11 +176,13 @@ def keepalive_until_here(*values): pass -def is_constant(thing): +def is_annotation_constant(thing): + """ Returns whether the annotator can prove that the argument is constant. + For advanced usage only.""" return True class Entry(ExtRegistryEntry): - _about_ = is_constant + _about_ = is_annotation_constant def compute_result_annotation(self, s_arg): from pypy.annotation import model diff --git a/pypy/rlib/test/test_objectmodel.py b/pypy/rlib/test/test_objectmodel.py --- a/pypy/rlib/test/test_objectmodel.py +++ b/pypy/rlib/test/test_objectmodel.py @@ -340,11 +340,11 @@ assert res == 84 def test_isconstant(self): - from pypy.rlib.objectmodel import is_constant, specialize + from pypy.rlib.objectmodel import is_annotation_constant, specialize @specialize.arg_or_var(0) def f(arg): - if is_constant(arg): + if is_annotation_constant(arg): return 1 return 10 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit