Philip Jenvey avatar Philip Jenvey committed 1fd7920

hopefully fix round w/ ndigits=None

Comments (0)

Files changed (3)


 # ____________________________________________________________
 def round(space, w_number, w_ndigits=None):
     """round(number[, ndigits]) -> number
         raise operationerrfmt(space.w_TypeError,
                               "type %s doesn't define __round__ method",
-    if space.is_none(w_ndigits):
+    if w_ndigits is None:
         return space.get_and_call_function(round, w_number)
         return space.get_and_call_function(round, w_number, w_ndigits)


         raises(TypeError, round, t)
         raises(TypeError, round, t, 0)
+        raises(TypeError, round, 3, None)
     def test_vars_obscure_case(self):
         class C_get_vars(object):
             def getDict(self):


            return q, r
 ''', filename=__file__).interphook('divmod_near')
 def descr___round__(space, w_long, w_ndigits=None):
     """To round an integer m to the nearest 10**n (n positive), we make
     use of the divmod_near operation, defined by:
     from pypy.objspace.std.longobject import W_AbstractIntObject, newlong
     assert isinstance(w_long, W_AbstractIntObject)
-    if space.is_none(w_ndigits):
+    if w_ndigits is None:
     ndigits = space.bigint_w(space.index(w_ndigits))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.