[pypy-svn] pypy default: Rewrite this with an assert so that the annotator knows

arigo commits-noreply at bitbucket.org
Mon Feb 14 22:21:56 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41935:df5c99fc3f20
Date: 2011-02-14 22:20 +0100
http://bitbucket.org/pypy/pypy/changeset/df5c99fc3f20/

Log:	Rewrite this with an assert so that the annotator knows it cannot be
	None. Thanks amaury for the general idea.

diff --git a/pypy/objspace/std/newformat.py b/pypy/objspace/std/newformat.py
--- a/pypy/objspace/std/newformat.py
+++ b/pypy/objspace/std/newformat.py
@@ -717,8 +717,11 @@
             out.append_multiple_char(fill_char[0], spec.n_spadding)
         if spec.n_digits != 0:
             if self._loc_thousands:
-                digits = grouped_digits if grouped_digits is not None \
-                         else self._grouped_digits
+                if grouped_digits is not None:
+                    digits = grouped_digits
+                else:
+                    digits = self._grouped_digits
+                    assert digits is not None
             else:
                 stop = to_digits + spec.n_digits
                 assert stop >= 0


More information about the Pypy-commit mailing list