[Python-checkins] r79272 - in python/branches/release31-maint: Lib/profile.py Misc/NEWS
victor.stinner
python-checkins at python.org
Mon Mar 22 03:00:11 CET 2010
Author: victor.stinner
Date: Mon Mar 22 03:00:11 2010
New Revision: 79272
Log:
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.
........
Modified:
python/branches/release31-maint/ (props changed)
python/branches/release31-maint/Lib/profile.py
python/branches/release31-maint/Misc/NEWS
Modified: python/branches/release31-maint/Lib/profile.py
==============================================================================
--- python/branches/release31-maint/Lib/profile.py (original)
+++ python/branches/release31-maint/Lib/profile.py Mon Mar 22 03:00:11 2010
@@ -609,11 +609,8 @@
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()
Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS (original)
+++ python/branches/release31-maint/Misc/NEWS Mon Mar 22 03:00:11 2010
@@ -143,6 +143,10 @@
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 #7774: Set sys.executable to an empty string if argv[0] has been set to
an non existent program name and Python is unable to retrieve the real
program name
More information about the Python-checkins
mailing list