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

Re: [pygame] BUG: required modules not raising error when failing to import was Re: [pygame] Surfarray.array_alpha() bugfix, py2exe/py2app segfault



Hi,

Zack Schilling has the distinction of being the first Pygame developer to use py2app/py2exe to wrap a game using NumPy. Before that no one noticed bufferproxy was missing.

So where to generate the import errors. bufferproxy is not critical to surface unless some other module needs a surface buffer. Either Surface.get_buffer can check for NULL pointers and raise an NotImplementedError if bufferproxy is missing or bufferproxy is made a requirement for surface to import properly. The former option could save a little space if array packages are not used, but is potentially confusing. Since buffers may be used elsewhere I prefer the later option myself.

A missing surflock already raises an ImportError. So for the surface module that leaves base, rect and color.

I suppose another possibly overlooked module is rwobject. That will need to be investigated as well.

Lenard


René Dudfield wrote:
ah yes, good one.


On Wed, Feb 4, 2009 at 2:07 PM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
Simple. The bufferproxy module is not included in the executables. I would
also check for surflock.

The moral of the story, when critical modules are missing, they should not
be quietly ignored. An exception has to be raised. Brian Fisher did this
with _numericsurfarray when Numeric is missing. It simply fails to import. I
did the same for _numericsndarray. Now it needs to be done for Pygame
extention modules that rely on other Pygame modules.



--
Lenard Lindstrom
<len-l@xxxxxxxxx>