Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / extlibs / mbedtls / mbedtls / tests / scripts / test_generate_test_code.py
index 6d7113e..73b9650 100755 (executable)
@@ -25,7 +25,7 @@ Unit tests for generate_test_code.py
 # pylint: disable=wrong-import-order
 try:
     # Python 2
-    from StringIO import StringIO
+    from io import StringIO
 except ImportError:
     # Python 3
     from io import StringIO
@@ -310,7 +310,7 @@ class StringIOWrapper(StringIO, object):
         self.line_no = line_no
         self.name = file_name
 
-    def next(self):
+    def __next__(self):
         """
         Iterator method. This method overrides base class's
         next method and extends the next method to count the line
@@ -321,7 +321,7 @@ class StringIOWrapper(StringIO, object):
         parent = super(StringIOWrapper, self)
         if getattr(parent, 'next', None):
             # Python 2
-            line = parent.next()
+            line = next(parent)
         else:
             # Python 3
             line = parent.__next__()