[Python-modules-team] Bug#480657: python-opengl: Using glutDisplayFunc and glutKeyboardFunc causes Segmentation Fault in glutMainLoop

Brendon Higgins blhiggins at gmail.com
Sun May 11 12:10:44 UTC 2008

Package: python-opengl
Version: 3.0.0~b1-2
Severity: normal

When the default python version in testing changed to 2.5 I found a program I had written failed with
segmentation faults. I've narrowed down the bug. The following is the smallest reasonable piece of
code which will cause the segfault:

from OpenGL.GLUT import *
glutInitWindowSize(640, 480);

def disFunc():
    print "disFunc"

def keyFunc(*args):
    print "keyFunc"


Pasting the code into python interactive mode demonstrates the problem as well as using a .py file.
Python will segfault as soon as it enters the glutMainLoop function. If either glutDisplayFunc(disFunc)
or glutKeyboardFunc(keyFunc) is commented out, there is no problem, and things behave as you would
expect them to. Also if I use python2.4, there is no problem. But if I use both keyFunc and disFunc
in python2.5: SIGSEGV, every time.

I'm not sure if a gdb backtrace is useful, but here it is, anyway:
#0  0x00002aaaabac5fcc in ?? ()
#1  0x00002aaaab314e83 in ?? () from /usr/lib/libglut.so.3
#2  0x00002aaaab318059 in fgEnumWindows () from /usr/lib/libglut.so.3
#3  0x00002aaaab31570e in glutMainLoopEvent () from /usr/lib/libglut.so.3
#4  0x00002aaaab315b38 in glutMainLoop () from /usr/lib/libglut.so.3
#5  0x00002b3dceb76e74 in ffi_call_unix64 () from /usr/lib/python2.5/lib-dynload/_ctypes.so
#6  0x00002b3dceb768bd in ffi_call () from /usr/lib/python2.5/lib-dynload/_ctypes.so
#7  0x00002b3dceb7179a in _CallProc () from /usr/lib/python2.5/lib-dynload/_ctypes.so
#8  0x00002b3dceb6b4ff in ?? () from /usr/lib/python2.5/lib-dynload/_ctypes.so
#9  0x0000000000417c73 in PyObject_Call ()
#10 0x00000000004854ca in PyEval_EvalFrameEx ()
#11 0x0000000000489756 in PyEval_EvalCodeEx ()
#12 0x0000000000489872 in PyEval_EvalCode ()
#13 0x00000000004ab339 in PyRun_InteractiveOneFlags ()
#14 0x00000000004ab544 in PyRun_InteractiveLoopFlags ()
#15 0x00000000004ab64a in PyRun_AnyFileExFlags ()
#16 0x000000000041442d in Py_Main ()
#17 0x00002b3dcdf091c4 in __libc_start_main () from /lib/libc.so.6
#18 0x00000000004139a9 in _start ()


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python-opengl depends on:
ii  freeglut3                     2.4.0-6    OpenGL Utility Toolkit
ii  libgl1-mesa-glx [libgl1]      7.0.3-1    A free implementation of the OpenG
ii  libglu1-mesa [libglu1]        7.0.3-1    The OpenGL utility library (GLU)
ii  python                        2.5.2-1    An interactive high-level object-o
ii  python-central                0.6.6      register and build utility for Pyt
ii  python-ctypes                 1.0.2-4    Python package to create and manip
ii  python-pkg-resources          0.6c8-3    Package Discovery and Resource Acc

python-opengl recommends no packages.

-- no debconf information

More information about the Python-modules-team mailing list