astropy/astropy-helpers — pull request #43 by embray (2014-06-26 21:03:04+00:00)
Title: Fix automodapi/automodsumm to document Cython functions

This issue was revealed by photutils in astropy/photutils#84 . Cython functions appear in python as `builtin_function_or_method` types instead of regular `function`s. Unintuitively, `inspect.isfunction` returns `False` if called on a `builtin_function_or_method`. Because `automodsumm` and `automodapi` use `isfunction` to decide if something is a function (and thus whether it should be documented), Cython functions do not get documented.

The solution is to go through and replace `inspect.isfunction` calls with something like ``type(obj) in (types.FunctionType, types.BuiltinFunctionType)``. I'll try to get to this when I have a chance, but if someone else gets there first, that's fine too.

(Note that something like this might also be true for Cython-defined classes, but I don't have one convenient to check this with...)