[pypy-commit] pypy SomeRange: Inline bk.getlistdef()

rlamy pypy.commits at gmail.com
Sat Jan 30 13:42:37 EST 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: SomeRange
Changeset: r82007:b1921df13e50
Date: 2016-01-30 06:03 +0000
http://bitbucket.org/pypy/pypy/changeset/b1921df13e50/

Log:	Inline bk.getlistdef()

diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -171,25 +171,23 @@
         clsdefs = {self.getuniqueclassdef(cls) for cls in exc_classes}
         return SomeException(clsdefs)
 
-    def getlistdef(self, **flags_if_new):
-        """Get the ListDef associated with the current position."""
+    def newlist(self, *s_values):
+        """Make a SomeList associated with the current position, general
+        enough to contain the s_values as items."""
         try:
             listdef = self.listdefs[self.position_key]
         except KeyError:
             listdef = self.listdefs[self.position_key] = ListDef(self)
-            listdef.listitem.__dict__.update(flags_if_new)
-        return listdef
-
-    def newlist(self, *s_values):
-        """Make a SomeList associated with the current position, general
-        enough to contain the s_values as items."""
-        listdef = self.getlistdef()
         for s_value in s_values:
             listdef.generalize(s_value)
         return SomeList(listdef)
 
     def newrange(self, s_item, step):
-        listdef = self.getlistdef(range_step=step)
+        try:
+            listdef = self.listdefs[self.position_key]
+        except KeyError:
+            listdef = self.listdefs[self.position_key] = ListDef(self)
+            listdef.listitem.range_step = step
         listdef.generalize(s_item)
         listdef.generalize_range_step(step)
         return SomeList(listdef)


More information about the pypy-commit mailing list