From 29fa09a16ec47a6e6d6a05c3f67888f11f060de7 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 11 Jun 2020 23:00:32 +0900 Subject: [PATCH] Fix #7802: autodoc: EOFError is raised on parallel build sphinx-build has crashed with EOFError when autodoc raises a warning having exc_info under parallel mode. In parallel mode, all messages are pickled to transfer logs to parent process. But the warning is not picklable because it contains a traceback object. This removes exc_info from warning messages to prevent crashes. --- CHANGES | 1 + sphinx/ext/autodoc/__init__.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index e709d0330..00488fb54 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,7 @@ Features added Bugs fixed ---------- +* #7802: autodoc: EOFError is raised on parallel build * #7811: sphinx.util.inspect causes circular import problem Testing diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 06961d1f8..64b56847b 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -422,9 +422,9 @@ class Documenter: if matched: args = matched.group(1) retann = matched.group(2) - except Exception: - logger.warning(__('error while formatting arguments for %s:') % - self.fullname, type='autodoc', exc_info=True) + except Exception as exc: + logger.warning(__('error while formatting arguments for %s: %s'), + self.fullname, exc, type='autodoc') args = None result = self.env.events.emit_firstresult('autodoc-process-signature', @@ -795,8 +795,8 @@ class Documenter: # parse right now, to get PycodeErrors on parsing (results will # be cached anyway) self.analyzer.find_attr_docs() - except PycodeError: - logger.debug('[autodoc] module analyzer failed:', exc_info=True) + except PycodeError as exc: + logger.debug('[autodoc] module analyzer failed: %s', exc) # no source file -- e.g. for builtin and C modules self.analyzer = None # at least add the module.__file__ as a dependency