[issue16722] __index__() overrides __bytes__() when bytes() is called

2012-12-19 Thread Benjamin Peterson
Benjamin Peterson added the comment: I'm afraid we can only fix this in 3.4 lest someone is relying on it. -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16722 ___

[issue16722] __index__() overrides __bytes__() when bytes() is called

2012-12-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset c744b6f8a09a by Benjamin Peterson in branch '3.3': try to call __bytes__ before __index__ (closes #16722) http://hg.python.org/cpython/rev/c744b6f8a09a New changeset 7c717d423160 by Benjamin Peterson in branch 'default': merge 3.3 (#16722)

[issue16722] __index__() overrides __bytes__() when bytes() is called

2012-12-19 Thread Benjamin Peterson
Changes by Benjamin Peterson benja...@python.org: -- resolution: fixed - stage: committed/rejected - status: closed - open versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16722

[issue16722] __index__() overrides __bytes__() when bytes() is called

2012-12-19 Thread Benjamin Peterson
Changes by Benjamin Peterson benja...@python.org: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16722 ___

[issue16722] __index__() overrides __bytes__() when bytes() is called

2012-12-19 Thread Andrew Svetlov
Andrew Svetlov added the comment: Is it coupled with #15559? If true we can relax ipaddress with adding __index__ again for 3.4 -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16722

[issue16722] __index__() overrides __bytes__() when bytes() is called

2012-12-19 Thread Andrew Svetlov
Andrew Svetlov added the comment: BTW, Руслан, can you change your name to use latin alphabet? I'm Андрей Светлов, but use Andrew Svetlov for tracker. Latin transcription is much easier to remember for all python users who don't speak Russian. For that guys your name looks like Chinese one for

[issue16722] __index__() overrides __bytes__() when bytes() is called

2012-12-19 Thread Руслан Ижбулатов
Руслан Ижбулатов added the comment: Yes, i saw #15559 ( well, actually, i saw the related discussion http://mail.python.org/pipermail/python-dev/2012-August/121241.html ) while looking for an answer. It's more narrow - i.e. manifestation of this issue in ipaddress case where some people

[issue16722] __index__() overrides __bytes__() when bytes() is called

2012-12-18 Thread Руслан Ижбулатов
New submission from Руслан Ижбулатов: If a class implements both __index__() and __bytes__(), the built-in bytes() constructor uses __index__() in place of __bytes__(), including the assumption that __index__() returns a bytes object. Attaching a simple example (leads to overflow when big