Windson Yang <wiwind...@outlook.com> added the comment:
I tried to create a PR for it, However, I don't know how to handle the code at https://github.com/python/cpython/blob/d4c76d960b/Lib/site.py#L159 So how to check UnicodeDecodeError when we just open the file, I use readlines() but it may use too many memory than before (I'm not sure it's important in this case). try: f = open(fullname, "r") data = f.readlines() except UnicodeDecodeError: f = open(fullname, "r", encoding="utf-8") data = f.readlines() ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35131> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com