[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] BUG: floating point exception in pygame.transform.average_color



I believe the attached patch solves the problem. If the rectangle lies completely outside the surface, average_color raises an exception. I'm not sure if I can write a unit test. Never done before.


On 4 June 2013 09:30, René Dudfield <renesd@xxxxxxxxx> wrote:
Thanks!

Can you turn it into a unit test?


On Mon, Jun 3, 2013 at 11:17 PM, Joost van Zwieten <joostvanzwieten@xxxxxxxxx> wrote:
Hi,

When trying to determine the average color of a surface inside a
rectangle which is located just outside the visible region, python
crashes with a floating point exception. A silly thing to do, but I
think that pygame should tell me I'm silly (-: Attached is a minimal
script which triggers the bug.

I am running debian wheezy, python 2.7.3-6 and pygame
1.9.1release+dfsg-8. If you need more info, please let me know.

Kind regards,

Joost van Zwieten


Attachment: average_color_bug_1.patch
Description: Binary data