Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #8655: autodoc: Crashes when object raises an exception on hasattr() #8656

Merged
merged 1 commit into from Jan 6, 2021

Conversation

tk0miya
Copy link
Member

@tk0miya tk0miya commented Jan 5, 2021

Feature or Bugfix

  • Bugfix

Purpose

… on hasattr()

autodoc crashes when the target object raises an exception on
`hasattr()`.  The `hasattr()` function internally calls the
`obj.__getattr__()` or `obj.__getattribute__()` of the target object.
Hence the reaction can be changed on the target object.

This starts to use `safe_getattr()` to check the object is mocked or not
and to prevent an unexpected error.
@tk0miya tk0miya added this to the 3.4.3 milestone Jan 5, 2021
@tk0miya tk0miya merged commit ac12d8d into sphinx-doc:3.4.x Jan 6, 2021
@tk0miya tk0miya deleted the 8655_exception_on_hasattr branch January 6, 2021 17:12
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant