summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
authorBen Reynwar2011-02-27 23:14:26 -0700
committerBen Reynwar2011-02-27 23:14:26 -0700
commitd7093fd06d0ec37f6ba2841d202fe90f4fa3661e (patch)
tree99c12d8aa62ad0903ba033aedaeec177dc339697 /gnuradio-core
parent1aa94c0ddbe9f610ed3a431a0980084d85e7311e (diff)
downloadgnuradio-d7093fd06d0ec37f6ba2841d202fe90f4fa3661e.tar.gz
gnuradio-d7093fd06d0ec37f6ba2841d202fe90f4fa3661e.tar.bz2
gnuradio-d7093fd06d0ec37f6ba2841d202fe90f4fa3661e.zip
Fixed to make compatible with python 2.4
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/qa_constellation.py7
-rw-r--r--gnuradio-core/src/python/gnuradio/gr_xmlrunner.py12
2 files changed, 11 insertions, 8 deletions
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_constellation.py b/gnuradio-core/src/python/gnuradio/gr/qa_constellation.py
index 054b01804..5c3c04160 100644
--- a/gnuradio-core/src/python/gnuradio/gr/qa_constellation.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_constellation.py
@@ -22,7 +22,6 @@
import random
from cmath import exp, pi, log
-from itertools import product
from gnuradio import gr, gr_unittest, blks2
from gnuradio.utils import mod_codes
@@ -52,8 +51,10 @@ def threed_constell():
oned_points = ((1+0j), (0+1j), (-1+0j), (0-1j))
points = []
r4 = range(0, 4)
- for ia, ib, ic in product(r4, r4, r4):
- points += [oned_points[ia], oned_points[ib], oned_points[ic]]
+ for ia in r4:
+ for ib in r4:
+ for ic in r4:
+ points += [oned_points[ia], oned_points[ib], oned_points[ic]]
rot_sym = 4
dim = 3
return gr.constellation_calcdist(points, [], rot_sym, dim)
diff --git a/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py b/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py
index ded77f5f3..c3dc5cf13 100644
--- a/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py
+++ b/gnuradio-core/src/python/gnuradio/gr_xmlrunner.py
@@ -6,8 +6,6 @@ XML Test Runner for PyUnit
# the Public Domain. With contributions by Paolo Borelli and others.
# Added to GNU Radio Oct. 3, 2010
-from __future__ import with_statement
-
__version__ = "0.1"
import os.path
@@ -185,7 +183,9 @@ class XMLTestRunner(object):
result = _XMLTestResult(classname)
start_time = time.time()
- with _fake_std_streams():
+ fss = _fake_std_streams()
+ fss.__enter__()
+ try:
test(result)
try:
out_s = sys.stdout.getvalue()
@@ -195,6 +195,8 @@ class XMLTestRunner(object):
err_s = sys.stderr.getvalue()
except AttributeError:
err_s = ""
+ finally:
+ fss.__exit__(None, None, None)
time_taken = time.time() - start_time
result.print_report(stream, time_taken, out_s, err_s)
@@ -218,8 +220,8 @@ class _fake_std_streams(object):
def __enter__(self):
self._orig_stdout = sys.stdout
self._orig_stderr = sys.stderr
- sys.stdout = StringIO()
- sys.stderr = StringIO()
+ #sys.stdout = StringIO()
+ #sys.stderr = StringIO()
def __exit__(self, exc_type, exc_val, exc_tb):
sys.stdout = self._orig_stdout