Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bytearray.extend: Misleading error message #115323

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@smurfix

Description

@smurfix

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 thatbytes.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

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp