Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15250 - main/branches/2.1.7/bin
Date: Fri, 29 Jan 2010 18:48:34
Message-Id: E1NavtQ-0006qY-IN@stork.gentoo.org
1 Author: zmedico
2 Date: 2010-01-29 18:48:32 +0000 (Fri, 29 Jan 2010)
3 New Revision: 15250
4
5 Modified:
6 main/branches/2.1.7/bin/check-implicit-pointer-usage.py
7 Log:
8 Fix output handling to avoid potential UnicodeEncodeError. (trunk r15196)
9
10 Modified: main/branches/2.1.7/bin/check-implicit-pointer-usage.py
11 ===================================================================
12 --- main/branches/2.1.7/bin/check-implicit-pointer-usage.py 2010-01-29 18:48:21 UTC (rev 15249)
13 +++ main/branches/2.1.7/bin/check-implicit-pointer-usage.py 2010-01-29 18:48:32 UTC (rev 15250)
14 @@ -37,15 +37,20 @@
15 pointer_pattern = unicode(pointer_pattern, encoding='utf_8')
16 unicode_quote_open = unicode('\xE2\x80\x98', encoding='utf_8')
17 unicode_quote_close = unicode('\xE2\x80\x99', encoding='utf_8')
18 + out = sys.stdout
19 else:
20 unicode_quote_open = '\u2018'
21 unicode_quote_close = '\u2019'
22 + out = sys.stdout.buffer
23 pointer_pattern = re.compile(pointer_pattern)
24
25 last_implicit_filename = ""
26 last_implicit_linenum = -1
27 last_implicit_func = ""
28
29 +def write(msg):
30 + out.write(msg.encode('utf_8', 'backslashreplace'))
31 +
32 while True:
33 if sys.hexversion >= 0x3000000:
34 line = sys.stdin.buffer.readline().decode('utf_8', 'replace')
35 @@ -69,6 +74,7 @@
36 pointer_linenum = int(m.group(2))
37 if (last_implicit_filename == pointer_filename
38 and last_implicit_linenum == pointer_linenum):
39 - print(("Function `%s' implicitly converted to pointer at " \
40 - "%s:%d" % (last_implicit_func, last_implicit_filename,
41 - last_implicit_linenum)))
42 + write("Function `%s' implicitly converted to pointer at " \
43 + "%s:%d\n" % (last_implicit_func,
44 + last_implicit_filename,
45 + last_implicit_linenum))