This should also be inverted, into something like might_have_custom_attributes.

Better would be to define a new function `try_getattr_string` which encapsulates both this check and the `PyErr_Clear` runaround. That would majorly simplify the code below.