`0.5.__round__(None)` raises TypeError while CPython doesn't

Create issue
Issue #3033 resolved
Kang Seonghoon created an issue
>>> 0.5.__round__(None)
0

>>>> 0.5.__round__(None)
Traceback (most recent call last):
  File '<stdin>', line 1, in <module>
TypeError: 'NoneType' object cannot be interpreted as an integer

I’m not sure if this is a specified behavior of both CPython (in that ndigits can be None in the __round__ magic method) and PyPy (in that None counts as “invalid arguments” as mentioned from differences from CPython document).

Comments (4)

  1. Kang Seonghoon reporter
    • edited description

    (Sorry for updating the description multiple times, I think Bitbucket builtin editor mangles the text)

  2. Log in to comment