[pypy-issue] Issue #1964: pypy3: bytes() prefers __int__ over __bytes__ (pypy/pypy)

Christoph Reiter issues-reply at bitbucket.org
Sat Jan 17 12:30:39 CET 2015


New issue 1964: pypy3: bytes() prefers __int__ over __bytes__
https://bitbucket.org/pypy/pypy/issue/1964/pypy3-bytes-prefers-__int__-over-__bytes__

Christoph Reiter:

```
#!python

class Foo(object):

    def __int__(self):
        return 0

    def __bytes__(self):
        return str(0).encode("utf-8")

assert bytes(Foo()) == b"0"  # returns b"" on pypy3
```





More information about the pypy-issue mailing list