Message327715
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". |
|
Date |
User |
Action |
Args |
2018-10-14 16:53:27 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, r.david.murray |
2018-10-14 16:53:27 | serhiy.storchaka | set | messageid: <1539536007.23.0.788709270274.issue34984@psf.upfronthosting.co.za> |
2018-10-14 16:53:27 | serhiy.storchaka | link | issue34984 messages |
2018-10-14 16:53:27 | serhiy.storchaka | create | |
|