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

Re: [pygame] fmodf on msvc transform.c... any ideas brian?



So the crash on running unittests on my machine was a somewhat crazy combination of events. Basically the sequence of tests were making it so the numeric detection would fail and cause a crash when there is no numeric and no numpy installed, but surfarray was used

---
The long explanation is that when the C module _numericsurfarray was imported, it would mark an exception when it couldn't import numeric, but the _numpysurfarray module would still have completed import (the Py_InitModule3 succeeding is all that's needed to create the module, regardless of whether module init raises an exception). Moreover, the created module has bad function pointers to numeric functions.

That in and of itself was not much of a problem, except that for some reason the "import pygame.surfarray" line surfarray_test.py gives surfarray a second chance to load (when it has already failed once on "import pygame"), and on the second pass _numericsurfarray has been imported, so "import pygame._numericsurfarray as numericsf" just binds the existing module to the name and skips the attempt to import numeric
.
Then when something tries to do numeric functions (in my case surf, surfarray things it can use the numeric stuff, but the module has bad function pointers, and boom.

---
I committed a fix for this that seems reasonable (_numericsurfarray doesn't create the module if it can't import numeric) which seemed to do the trick and still works when numeric is installed.

I guess though that I should have my build machine have at least one of numeric or numpy installed in order to pass tests in the future... ?