[BugFix] Python file source reading can fail on UnicodeDecodeError (#32416)
Signed-off-by: Richard Zou <zou3519@gmail.com>
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user