mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2025-08-15 01:54:44 +08:00
debug statements hook works for non-utf8 files
This commit is contained in:
@ -35,7 +35,7 @@ class ImportStatementParser(ast.NodeVisitor):
|
||||
|
||||
def check_file_for_debug_statements(filename):
|
||||
try:
|
||||
ast_obj = ast.parse(open(filename).read(), filename=filename)
|
||||
ast_obj = ast.parse(open(filename, 'rb').read(), filename=filename)
|
||||
except SyntaxError:
|
||||
print('{} - Could not parse ast'.format(filename))
|
||||
print()
|
||||
|
Reference in New Issue
Block a user