Skip to content

Misleading error message when passing tuple of incorrect data type to ImageDraw methods #5939

@moritzvonberg

Description

@moritzvonberg

What did you do?

Accidentally passed ('7', '9', '97', '106') to ImageDraw.Draw().rectangle()

for example:

from PIL import Image, ImageDraw

with Image.open('test_screenshots/just letters.png') as image:
    draw = ImageDraw.Draw(image)
    draw.rectangle(('10', '10', '110', '110'))
    image.show()

What did you expect to happen?

An Error to be raised stating that the parameter xy is not a tuple of integers or some other apt description.

What actually happened?

A SystemError is raised with the message: SystemError: new style getargs format but argument is not a tuple despite the input being a tuple (albeit with incorrect contents).

What are your OS, Python and Pillow versions?

  • OS: Windows 10 Build 19042
  • Python: 3.10.0
  • Pillow: 9.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions