summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2010-01-11 19:16:19 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2010-01-11 19:16:19 +0000
commitbb4d1565296d4e3cd671864e52f4c5ac693bcdd1 (patch)
treeef78cdcfcc7d39da9871a346e5f56c874e851a57
parentb4ef1e6be09e5033e165ab1cfe062d23b00f0254 (diff)
downloadportage-bb4d1565296d4e3cd671864e52f4c5ac693bcdd1.tar.gz
portage-bb4d1565296d4e3cd671864e52f4c5ac693bcdd1.tar.bz2
portage-bb4d1565296d4e3cd671864e52f4c5ac693bcdd1.zip
Avoid potential UnicodeDecodeError with Python 3. Reported by devurandom.
svn path=/main/trunk/; revision=15192
-rwxr-xr-xbin/check-implicit-pointer-usage.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/check-implicit-pointer-usage.py b/bin/check-implicit-pointer-usage.py
index 100c4a4b1..e9790c850 100755
--- a/bin/check-implicit-pointer-usage.py
+++ b/bin/check-implicit-pointer-usage.py
@@ -19,6 +19,8 @@ from __future__ import print_function
import re
import sys
+from portage import _unicode_decode
+
implicit_pattern = re.compile("([^:]*):(\d+): warning: implicit declaration "
+ "of function [`']([^']*)'")
pointer_pattern = re.compile(
@@ -37,7 +39,10 @@ last_implicit_linenum = -1
last_implicit_func = ""
while True:
- line = sys.stdin.readline()
+ if sys.hexversion >= 0x3000000:
+ line = _unicode_decode(sys.stdin.buffer.readline())
+ else:
+ line = sys.stdin.readline()
if line == '':
break
# translate unicode open/close quotes to ascii ones