Issue #4282: Fix the main function of the profile module for a non-ASCII

script, open the file in binary mode and not in text mode with the default
(utf8) encoding.
This commit is contained in:
Victor Stinner 2010-03-22 01:58:35 +00:00
parent 434ae7703d
commit e3a1f6d3b7
2 changed files with 5 additions and 4 deletions

View File

@ -602,11 +602,8 @@ def main():
if (len(args) > 0): if (len(args) > 0):
sys.argv[:] = args sys.argv[:] = args
sys.path.insert(0, os.path.dirname(sys.argv[0])) sys.path.insert(0, os.path.dirname(sys.argv[0]))
fp = open(sys.argv[0]) with open(sys.argv[0], 'rb') as fp:
try:
script = fp.read() script = fp.read()
finally:
fp.close()
run('exec(%r)' % script, options.outfile, options.sort) run('exec(%r)' % script, options.outfile, options.sort)
else: else:
parser.print_usage() parser.print_usage()

View File

@ -285,6 +285,10 @@ C-API
Library Library
------- -------
- Issue #4282: Fix the main function of the profile module for a non-ASCII
script, open the file in binary mode and not in text mode with the default
(utf8) encoding.
- Issue #8179: Fix macpath.realpath() on a non-existing path. - Issue #8179: Fix macpath.realpath() on a non-existing path.
- Issue #8024: Update the Unicode database to 5.2. - Issue #8024: Update the Unicode database to 5.2.