diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-22 02:00:11 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-22 02:00:11 (GMT) |
commit | cfbb23a4dd0341577a10fa4660ee7450b58da45f (patch) | |
tree | 8a95d989ffa13ec42c56829580029580564faba6 /Lib | |
parent | 4e74fc82eaa4617953bdd441f606002420df5ed0 (diff) | |
download | cpython-cfbb23a4dd0341577a10fa4660ee7450b58da45f.zip cpython-cfbb23a4dd0341577a10fa4660ee7450b58da45f.tar.gz cpython-cfbb23a4dd0341577a10fa4660ee7450b58da45f.tar.bz2 |
Merged revisions 79271 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r79271 | victor.stinner | 2010-03-22 02:58:35 +0100 (lun., 22 mars 2010) | 4 lines
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.
........
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/profile.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/profile.py b/Lib/profile.py index d969246..2a96ba8 100755 --- a/Lib/profile.py +++ b/Lib/profile.py @@ -609,11 +609,8 @@ def main(): if (len(args) > 0): sys.argv[:] = args sys.path.insert(0, os.path.dirname(sys.argv[0])) - fp = open(sys.argv[0]) - try: + with open(sys.argv[0], 'rb') as fp: script = fp.read() - finally: - fp.close() run('exec(%r)' % script, options.outfile, options.sort) else: parser.print_usage() |