This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients r.david.murray, serhiy.storchaka
Date 2018-10-14.16:53:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1539536007.23.0.788709270274.issue34984@psf.upfronthosting.co.za>
In-reply-to
Content
The proposed PR improves error messages in bytes and bytearray constructors.

1. When pass only encoding or errors to the bytes or bytearray constructor, it raises a TypeError with the message "encoding or errors without sequence argument". But the required argument is not a sequence, it is a string. "sequence argument" will be replaced with "a string argument".

2. Also "encoding or errors" will be replaced with just "encoding" or "errors", as in bytes(0, 'utf-8') and bytes(0, errors='utf-8').

3. When pass an unsupported type to the bytearray constructor, it raises  a TypeError with the message like "'float' object is not iterable". It will be replaced with "cannot convert 'float' object to bytearray" (similar to the message raised in the bytes constructor).

4. When pass an unsupported type to the bytearray's extend() method, it raises  a TypeError with the message like "'float' object is not iterable". It will be replaced with "can't extend bytearray with float".
History
Date User Action Args
2018-10-14 16:53:27serhiy.storchakasetrecipients: + serhiy.storchaka, r.david.murray
2018-10-14 16:53:27serhiy.storchakasetmessageid: <1539536007.23.0.788709270274.issue34984@psf.upfronthosting.co.za>
2018-10-14 16:53:27serhiy.storchakalinkissue34984 messages
2018-10-14 16:53:27serhiy.storchakacreate