After a multiple-days debugging orgy I finally found what's triggering this. Please see https://bugzilla.gnome.org/show_bug.cgi?id=669157 for the whole story, but copying the last comment here for convenience: The Debian package runs this snippet between configure and make, to configure static (builtin) vs. dynamic (extensions) modules: egrep \ "^#($$(awk -v ORS='|' '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in)XX)" \ Modules/Setup.dist \ | sed -e 's/^#//' -e 's/-Wl,-Bdynamic//;s/-Wl,-Bstatic//' \ >> $(1)/Modules/Setup.local When I disable this part, the local build works. That code results in this Modules/Setup.local: ----------------- 8< --------------------- # Edit this file for local setup changes array arraymodule.c # array objects math mathmodule.c _math.c # -lm # math library functions, e.g. sin() _struct _struct.c # binary structure packing/unpacking time timemodule.c _time.c # -lm # time operations and variables _random _randommodule.c # Random number generator atexit atexitmodule.c # Register functions to be run at interpreter-shutdown _elementtree -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator _pickle _pickle.c # pickle accelerator _datetime _datetimemodule.c # datetime accelerator _bisect _bisectmodule.c # Bisection algorithms _heapq _heapqmodule.c # Heap queue algorithm unicodedata unicodedata.c # static Unicode character database fcntl fcntlmodule.c # fcntl(2) and ioctl(2) spwd spwdmodule.c # spwd(3) grp grpmodule.c # grp(3) select selectmodule.c # select(2); not on ancient System V _socket socketmodule.c _ssl _ssl.c -lssl -lcrypto _posixsubprocess _posixsubprocess.c # POSIX subprocess module helper _hashlib _hashopenssl.c -lssl -lcrypto syslog syslogmodule.c # syslog daemon interface binascii binascii.c _ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c _ctypes/malloc_closure.c -lffi zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz pyexpat pyexpat.c -lexpat ----------------- 8< --------------------- Bisecting this quickly leads to the _ctypes module configuration. So a small reproducer based on the upstream Python 3.2 build is: * Configure and build pygobject with PYTHON=python3.2 (or specify the full path for a local python build) * Build python 3.2 with the broken _ctypes module configuration: $ cd /tmp/ $ tar xf python3.2_3.2.3.orig.tar.gz $ cd python3.2-3.2.3 $ ./configure --with-wide-unicode # to be compatible with the Debian/Ubuntu python 3.2 $ echo '_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c _ctypes/malloc_closure.c -lffi' >> Modules/Setup.local $ make -j4 Then in the pygobject built tree, run $ (cd tests; TEST_NAMES=test_everything.TestCallbacks PYTHONPATH=..:. LD_LIBRARY_PATH=./.libs GI_TYPELIB_PATH=. /tmp/python3.2-3.2.3/python ./runtests.py) which reproduces the failure. Conversely, if I change the ctypes line in debian/PVER-minimal.README.Debian.in from _ctypes extension to _ctypes builtin and build/install the packages, everything works. For a more convenient reproducer on the Debian/Ubuntu side, you can just run "python3 set_cell_data_func.py", i. e. the attached sample code here. So there is something wrong with how this configures the _ctypes module to be linked into python itself, instead of being a separate module (/usr/lib/python3.2/lib-dynload/_ctypes.cpython-32mu.so) that you get with "builtin" (that is indeed pretty confusing, given that I switched it _from_ "extension" _to_ "builtin". Or there is a Python 3.2/libffi bug which causes that.