[pypy-commit] pypy default: rename to is_annotation_constant. add a docstring.

cfbolz noreply at buildbot.pypy.org
Thu Sep 29 10:35:05 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at 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
 


More information about the pypy-commit mailing list