From 5a276bde86201a863dbdc52b5e0790db074586fd Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Wed, 9 Aug 2023 15:10:04 -0400 Subject: [PATCH] FIX: Tolerate huge year --- sphinx/environment/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py index 3dbc5932b6a..37472387ddd 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -511,13 +511,17 @@ def get_outdated_files(self, config_changed: bool) -> tuple[set[str], set[str], break depmtime = _last_modified_time(deppath) if depmtime > mtime: + try: + depmtime_dt = datetime.utcfromtimestamp(depmtime) + except ValueError: # e.g., year 53606865 is out of range + depmtime_dt = depmtime logger.debug( '[build target] outdated %r ' 'from dependency %r: %s -> %s', docname, deppath, datetime.utcfromtimestamp(mtime), - datetime.utcfromtimestamp(depmtime)) + depmtime_dt) changed.add(docname) break except OSError: