Skip to content

Using a del statement only with a tuple or string indexed gets the error message with doesn't instead of does not #135699

Closed as not planned
@hyperkai

Description

@hyperkai

Bug report

Bug description:

Using a del statement only with a tuple indexed gets the error message with doesn't instead of does not as shown below:

v = ('a', 'b', 'c')

v[1] = 'A'
# TypeError: 'tuple' object does not support item assignment

v[1:3] = ['A', 'B']
# TypeError: 'tuple' object does not support item assignment

del v[1]
# TypeError: 'tuple' object doesn't support item deletion
                          # ↑↑↑↑↑↑↑
del v[1:3]
# TypeError: 'tuple' object does not support item deletion

And, using a del statement only with a string indexed gets the error message with doesn't instead of does not as shown below:

v = 'abc'

v[1] = 'A'
# TypeError: 'str' object does not support item assignment

v[1:3] = ['A', 'B']
# TypeError: 'str' object does not support item assignment

del v[1]
# TypeError: 'str' object doesn't support item deletion
                        # ↑↑↑↑↑↑↑
del v[1:3]
# TypeError: 'str' object does not support item deletion

CPython versions tested on:

3.13

Operating systems tested on:

Windows

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