GNOME Bugzilla – Bug 581082
segfault with new glib.get_user_special_dir
Last modified: 2009-05-03 12:54:50 UTC
I hope this is not me just being a newbie, but I am trying to use the new special dir wrapping in pygobject 2.17.0. I am using the code below, but instead of printing the directory name, I get a segfault. I can attached a backtrace, but I am assuming that this is either easily reproducible or me using the API wrongly. bob = glib.get_user_special_dir(glib.USER_DIRECTORY_MUSIC) print bob
gianmt@urano:~$ python Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import glib >>> bob = glib.get_user_special_dir(glib.USER_DIRECTORY_MUSIC) >>> print bob /home/gianmt/Music >>>
oh well, forgot to mention >>> glib.glib_version (2, 20, 1) >>> glib.pyglib_version (2, 17, 0) >>>
I originally had a lower version glib, but I upgraded before filing this bug report and I have the exact same versions as you. >>> import glib >>> bob = glib.get_user_special_dir(glib.USER_DIRECTORY_MUSIC) Segmentation fault [cschalle@crazyhorse devel]$ I am using Fedora and I have python version 2.5.2 The gdb backtrace is this: Starting program: /usr/bin/python xdgdir.py [Thread debugging using libthread_db enabled] [New Thread 0xb7fe26c0 (LWP 5946)] Program received signal SIGSEGV, Segmentation fault. 0x04803ee5 in _PyArg_ParseTupleAndKeywords_SizeT (args=0xb7fcc66c, keywords=0x5ed5f40, format=0x4add13 "i:glib.get_user_special_dir", kwlist=0x4b1618) at Python/getargs.c:1266 1266 if ((args == NULL || !PyTuple_Check(args)) || (gdb) thread apply all bt
+ Trace 215024
Thread 1 (Thread 0xb7fe26c0 (LWP 5946))
Created attachment 133829 [details] [review] potential fix I couldn't reproduce the bug, but I found something suspicious about the code. Can you test if this one-liner fixes the crash?
Hi Paul, Thanks a lot for the quick fix. This patch fixes it for me. Christian