1 |
Author: zmedico |
2 |
Date: 2009-08-06 22:44:45 +0000 (Thu, 06 Aug 2009) |
3 |
New Revision: 13943 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/util.py |
7 |
Log: |
8 |
In getconfig(), specify utf_8 encoding for py3k. |
9 |
|
10 |
|
11 |
Modified: main/trunk/pym/portage/util.py |
12 |
=================================================================== |
13 |
--- main/trunk/pym/portage/util.py 2009-08-06 22:39:16 UTC (rev 13942) |
14 |
+++ main/trunk/pym/portage/util.py 2009-08-06 22:44:45 UTC (rev 13943) |
15 |
@@ -387,7 +387,11 @@ |
16 |
# trailing newline after the source statement |
17 |
# NOTE: shex doesn't seem to supported unicode objects |
18 |
# (produces spurious \0 characters with python-2.6.2) |
19 |
- content = open(mycfg).read() |
20 |
+ if sys.hexversion < 0x3000000: |
21 |
+ content = open(mycfg, 'rb').read() |
22 |
+ else: |
23 |
+ content = open(mycfg, mode='r', |
24 |
+ encoding='utf_8', errors='replace').read() |
25 |
if content and content[-1] != '\n': |
26 |
content += '\n' |
27 |
except IOError, e: |