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 integer is casted to 
bytes).

----------
components: None
files: testb.py
messages: 177725
nosy: LRN
priority: normal
severity: normal
status: open
title: __index__() overrides __bytes__() when bytes() is called
versions: Python 3.3
Added file: http://bugs.python.org/file28357/testb.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16722>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to