[pypy-issue] Issue #3033: `0.5.__round__(None)` raises TypeError while CPython doesn't (pypy/pypy)

Kang Seonghoon issues-reply at bitbucket.org
Fri Jun 28 22:30:40 EDT 2019


New issue 3033: `0.5.__round__(None)` raises TypeError while CPython doesn't
https://bitbucket.org/pypy/pypy/issues/3033/05__round__-none-raises-typeerror-while

Kang Seonghoon:

```python
>>> 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 commented from [differences from CPython document](https://pypy.readthedocs.io/en/latest/cpython_differences.html)\).




More information about the pypy-issue mailing list