-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug description:
b=bytearray(b"abc")
b.extend('def')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'str' object cannot be interpreted as an integer```
… except that bytes.extend
doesn't even accept integers as arguments; the error refers to the first element of the string, which happens also to be a string in Python. Meh.
Could CPython please complain about requiring the string to be encoded instead?
CPython versions tested on:
main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error