Fix segfault.
Merge pull request #287 from robwhess/dev

Fix python segfault in Mac OS X.