|
@@ -5,6 +5,7 @@ from __future__ import print_function
|
|
import argparse
|
|
import argparse
|
|
import inspect
|
|
import inspect
|
|
import re
|
|
import re
|
|
|
|
+import six
|
|
import sys
|
|
import sys
|
|
|
|
|
|
import checkpackagelib.lib_config
|
|
import checkpackagelib.lib_config
|
|
@@ -103,10 +104,15 @@ def check_file_using_lib(fname):
|
|
|
|
|
|
for cf in objects:
|
|
for cf in objects:
|
|
nwarnings += print_warnings(cf.before())
|
|
nwarnings += print_warnings(cf.before())
|
|
- for lineno, text in enumerate(open(fname, "r").readlines()):
|
|
|
|
|
|
+ if six.PY3:
|
|
|
|
+ f = open(fname, "r", errors="surrogateescape")
|
|
|
|
+ else:
|
|
|
|
+ f = open(fname, "r")
|
|
|
|
+ for lineno, text in enumerate(f.readlines()):
|
|
nlines += 1
|
|
nlines += 1
|
|
for cf in objects:
|
|
for cf in objects:
|
|
nwarnings += print_warnings(cf.check_line(lineno + 1, text))
|
|
nwarnings += print_warnings(cf.check_line(lineno + 1, text))
|
|
|
|
+ f.close()
|
|
for cf in objects:
|
|
for cf in objects:
|
|
nwarnings += print_warnings(cf.after())
|
|
nwarnings += print_warnings(cf.after())
|
|
|
|
|