New submission from Terry J. Reedy:

If an object ob does not have a __bytes__ method or buffer interface and is not 
a string, integer, or iterable, bytes(ob) fails with 

TypeError: 'object' object is not iterable

This is misleadingly narror (similar to #17032). We should either list *all* 
the things that ob is not

'object' object is not a string, integer, or iterable and does not have a 
__bytes__ method or buffer interface

or simply say

'object' object cannot be converted to bytes

and let the programmer recheck what can be.

----------
components: Interpreter Core
messages: 183345
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: bytes() TypeError message is misleadingly narrow
type: enhancement
versions: Python 3.4

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

Reply via email to