I assume that your function definition should not have an empty body. I checked your code by adding the no-op operator as the function body:
fAst = ast.FunctionDef(
And the segmentation error has disappeared; exit:
<function foo at 0x022DB3F0>
If I'm right, this could be a mistake in the ast module, since it should check for an empty body.
source share