[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] intermittant fails of unit test pixelarray_test.PixelArrayTest with Python 2.4
are all the warnings fixed for that code? Maybe that'd give a clue?
setup.py -warnings
Have you tried a different video driver? Maybe that'd change things.
On Wed, Feb 27, 2008 at 7:07 AM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
> Brian Fisher wrote:
> > It seems to me once the failure is reliably repeatable it should be
> > fairly straightforward to debug, right?
> >
> >
> I wish. :-)
>
>
> > ...but I'm a bit confused, looking at the test that is failing, I'm
> > not sure how that could be considered a repeatable test...
> >
> >
> The fails are not 100%, but nearly so. And it differs between Pythons
> 2.4 and 2.5.
>
>
> > with 8 bpp, don't you have to set a palette? the SDL docs
> > SDL_CreateRGBSurface say: "If depth is 8 bits an empty palette is
> > allocated for the surface" - and set_at is calling SDL_MapRGBA which
> > will map the (255, 255, 255) tuple to the closest index in the
> > palette. Also, the "in" operator on PixelArray objects always works on
> > palette indices for 8 bit (if given a color tuple it will call
> > SDL_MapRGBA to map it to a palette index as well). So isn't the exact
> > behavior dependent on the values of an "empty palette"?
> >
> >
> It could be using a default device palette on Windows. Using
> get_palette, I compared the palettes of the test surface for both a pass
> and fail. They were identical.
>
>
> > So given that the palette is undefined, why shouldn't (255,255,255)
> > map to index 255 (0x000000ff)? And why shouldn't 0x000000ff exist as a
> > member of the array in that case? likewise why shouldn't (0,0,0) map
> > to index 255?
> >
> > So Lenard, when the test fails what does sf.map_rgb((255,255,255))
> > return? does it return 255? how about sf.map_rgb((0,0,0))?
> >
> For both pass and fail I get (0,0,0) --> 0, (255,255,255) --> 127. But
> sf.unmap_rgb(0x000000ff) is (255,255,255), the same as sf.get_at((8,8)).
> So the test should always fail. The question now becomes, why does it pass?
>
> To check if screen depth has anything to do with this I set my display
> to 32 bit and rebooted. The test failed for Python 2.4 and passed for
> 2.5. But True Color on my system has no alpha channel. Maybe alpha
> affects the test on XP.
>
> This behavior is consistent with accessing a memory location whose value
> is undefined. Just adding a "print 'x'," at the start of test_contains
> was enough to make the fails nearly 100% for Python 2.4. I will keep
> looking.
>
> --
>
>
> Lenard Lindstrom
> <len-l@xxxxxxxxx>
>
>