[BugFix] Python file source reading can fail on UnicodeDecodeError (#32416)

Signed-off-by: Richard Zou <zou3519@gmail.com>
This commit is contained in:
Richard Zou
2026-01-15 15:01:41 -05:00
committed by GitHub
parent 41c544f78a
commit bd292be0c0

View File

@@ -606,7 +606,7 @@ class VllmBackend:
try: try:
with open(filepath) as f: with open(filepath) as f:
hash_content.append(f.read()) hash_content.append(f.read())
except OSError: except (OSError, UnicodeDecodeError):
logger.warning("Failed to read file %s", filepath) logger.warning("Failed to read file %s", filepath)
continue continue
code_hash = hashlib.sha256("\n".join(hash_content).encode()).hexdigest() code_hash = hashlib.sha256("\n".join(hash_content).encode()).hexdigest()