kern/177214: [patch] Issue with r241826 - Covert to python 3
hiren panchasara
hiren.panchasara at gmail.com
Fri Mar 22 00:00:02 UTC 2013
>Number: 177214
>Category: kern
>Synopsis: [patch] Issue with r241826 - Covert to python 3
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Mar 22 00:00:02 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: hiren panchasara
>Release: current
>Organization:
>Environment:
10.0-CURRENT FreeBSD 10.0-CURRENT #1 r248555: Wed Mar 20 15:00:20 UTC 2013
>Description:
r241826 removed raw_input() as its not available in python3.
But with python 2.7.3, this change is causing an interesting failure where its not picking newline char. My python foo is not good but I _think_ the patch attached will handle this case.
Please modify the patch if/as needed.
cheers,
Hiren
>How-To-Repeat:
You should be able to run through all the counters by just pressing return but with raw_input() taken away, thats not happening. It fails right after first counter.
/usr/src/tools/test/hwpmc # ./pmctest.py -p ls
# p/CLOCK.HARD
2
pmctest.py
next?
Traceback (most recent call last):
File "./pmctest.py", line 98, in <module>
main()
File "./pmctest.py", line 90, in main
value = input("next?")
File "<string>", line 0
^
SyntaxError: unexpected EOF while parsing
root at testhaswell:/usr/src/tools/test/hwpmc #
>Fix:
Index: tools/test/hwpmc/pmctest.py
===================================================================
--- tools/test/hwpmc/pmctest.py (revision 248555)
+++ tools/test/hwpmc/pmctest.py (working copy)
@@ -51,6 +51,9 @@
import subprocess
from subprocess import PIPE
+# Use input() for Python version 3
+if sys.version_info[0] == 3:
+ raw_input = input
+
# A list of strings that are not really counters, just
# name tags that are output by pmccontrol -L
notcounter = ["IAF", "IAP", "TSC", "UNC", "UCF", "UCP", "SOFT" ]
@@ -87,7 +90,7 @@
print(result)
if (options.wait == True):
try:
- value = input("next?")
+ value = raw_input("next?")
except EOFError:
sys.exit()
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list