Serhiy Storchaka added the comment:

Sorry, but it looks to me that issue28385.diff solves wrong issue. The issue is 
not in bytes, but in default __format__. object.__format__ should raise an 
error message that contains the name of the actual type. There are other issues 
with object.__format__, following patch tries to solve them.

1. Error message now contains the name of the actual type.

2. Format spec is checked before converting the value to str. Converting bytes 
and bytearray to str can raise a BytesWarning, and it is better if the type of 
this error doesn't depend on the -b option.

3. Since format spec is always empty, avoid calling PyObject_Format(). In 
theory PyObject_Str() can raise a subclass of str with non-trivial __format__, 
but I think we can ignore this subtle behavior difference.

----------
nosy: +serhiy.storchaka
Added file: http://bugs.python.org/file45015/object___format__.patch

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

Reply via email to