patch_f2py – Modify numpy.f2py at runtime

This module patches numpy.f2py at runtime, to customise the C code that is generated. We make several changes to f2py:

  1. Allow the Fortran present() function to work correctly with optional arguments. If an argument to an f2py wrapped function is optional and is not given, replace it with NULL.
  2. Allow Fortran routines to raise a RuntimeError exception with a message by calling an external function quippy_error_abort(). This is implemented using a setjmp()/ longjmp() trap.
  3. Allow Fortran routines to be interrupted with Ctrl+C by installing a custom interrupt handler before the call into Fortran is made. After the Fortran routine returns, the previous interrupt handler is restored.

Previous topic

f2py_wrapper_gen – Fortran 90 source code wrapping

Next topic

quippy.oo_fortran – Fortran 90 derived-type support

This Page