[wxPython] Is this is bug in wxPython's glcanvas?

Would it be possible for someone to see if this code segfaults on their
python installation (I'm using the wxPython-gl-2.3.0-1 and associated
rpms available from the wxPython man site, Mesa-3.1-1 rpms, and
PyOpenGL-1.5.6 source distribution).

It seems to be that setting certain numeric values in a gl function
(gluLookAt) causes the program to segfault once glFlush() has been called,
whereas setting other ones does not. Which package is the bug likely to be
due to?

The following program demonstrates the problem: search for the word "bug"
to find the part that is baffling me.

thanks very much

yan wong
oxford

···

-----------------------------------------------

#!/usr/bin/env python2

# ported to wxPython by greg Landrum
from OpenGL.GL import *
from OpenGL.GLU import *
from wxPython.wx import *
from wxPython.glcanvas import *
import os,sys

# This code is needed to avoid faults on sys.exit()
import sys
oldexitfunc = None
if hasattr(sys, 'exitfunc'):
    oldexitfunc = sys.exitfunc
def cleanup():
    if oldexitfunc: oldexitfunc()
sys.exitfunc = cleanup

class Opengl(wxGLCanvas):
  """
    wxPython bindings for an Opengl widget.
  """
  def __init__(self, parent,*args,**kw):
    apply(wxGLCanvas.__init__,(self,parent),kw)
    self.initialised = 0
    # Current coordinates of the mouse.
    EVT_PAINT(self,self.wxPaint)
    EVT_ERASE_BACKGROUND(self, self.wxEraseBackground)

  def wxPaint(self,*dummy):
    dc = wxPaintDC(self)
    self.wxRedraw()

  def wxEraseBackground(self, event):
    pass # Do nothing, to avoid flashing.

  def wxRedraw(self, event=None):
      """Cause the opengl widget to redraw itself."""
      dc = wxClientDC(self)
      self.SetCurrent()
      if not self.initialised:
          glMatrixMode(GL_PROJECTION);
          glLoadIdentity()
          glFrustum(-0.5, 0.5, -0.5, 0.5, 1.0, 3.0);
          glMatrixMode(GL_MODELVIEW);
          glLoadIdentity()
          glEnable(GL_DEPTH_TEST);
          glEnable(GL_LIGHTING);
          glEnable(GL_LIGHT0);

          glClearColor(1.0,1.0,1.0,1.0)
          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT )
          self.initialised = 1

      glPushMatrix()
      size = self.GetClientSize()
      w = size.width
      h = size.height
      glViewport(0, 0, w, h)

      # Clear the background and depth buffer.
      glClearColor(1.0, 0.0, 1.0, 0.0)
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

      glMatrixMode(GL_PROJECTION);
      glLoadIdentity()
      gluPerspective(30.0, float(w)/float(h), 0.1, 1000.0)

      gluLookAt(0.0, 0.0, 2.3, # <-replace 2.3 by 2.5 to avoid bug
                0.0, 0.0, 0.0,
                0., 1., 0.)

      glMatrixMode(GL_MODELVIEW);

      glBegin(GL_QUADS)
      glNormal3f( 0.0, 0.0, 1.0)
      glVertex3f( 0.5, 0.5, 0.5)
      glVertex3f(-0.5, 0.5, 0.5)
      glVertex3f(-0.5,-0.5, 0.5)
      glVertex3f( 0.5,-0.5, 0.5)
      glEnd()

      print "test1"
      glFlush() # Tidy up
      print "test2"

      glPopMatrix() # Restore the matrix
      self.SwapBuffers()
      if event: event.Skip()

if __name__ == '__main__':
  class MyApp(wxApp):
    def OnInit(self):
      frame = wxFrame(NULL, -1, "wxPython Context", wxDefaultPosition, wxSize(300,300))
      win = Opengl(frame)
      frame.Show(TRUE)
      self.SetTopWindow(frame)
      return TRUE
  app = MyApp(0)
  app.MainLoop()