[f2py] Segmentation fault after successful call
spacecolonyone <[email protected]> Thu, 9 Jan 2014 23:09:25 -0500
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Hi All, I'm new to f2py and have been trying to wrap a small legacy fortran code that used to run as a stand alone program with text file io. I've gotten it wrapped and it functions properly, with the caveat that it segfaults when I return from any function two levels above the f2py'ed module. For instance Generated the .so with f2py -c m2fsholesxy.pyf *.f90 -m m2fsholesxy In test.py: def make_call_to_m2fsholesxy(*args): #setup numpy input arrays based on some python lists in args foo=m2fsholesxy.m2fsholesxy( .... ) #post process results #optionally import pdb and play with post-processed results #everything looks dandy #Normally would return some results that do not share memory with anything # sent or received from m2fsholesxy return None def prep_to_call_m2fsholesxy(): #load some data from disk make_call_to_m2fsholesxy(some data) return None def driver() prep_to_call_m2fsholesxy() >>> driver() will segfault at the return (the return will not complete) from prep_to_call_m2fsholesxy. I am totally stumped. I stress that the stuff I get back from the fortran code looks great and is exactly the same as what I'd get with the old stand alone version. The module doesn't do any io and is entirely self contained, no callbacks, nothing. I've verified that I don't get this behavior with tutorial examples I've found online, so it is something I'm doing. I've put a pastebin of the top level subroutine here: http://pastebin.com/BabnYtu1 The pyf file is here: http://pastebin.com/dxeNx5Bb numpy.__version__='1.9.0.dev-e770f92' (going back to 1.8.0 doesn't make it any better) f2py -v = 2 sys.version=='2.7.5 (default, Aug 25 2013, 00:04:04) \n[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]' OS X 10.9 Any insight or help would be greatly appreciated. Thanks, Jeb