Improve performance of :func:`inspect.getattr_static`. Patch by Alex Waygood.