prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Redhat 6.5 can no longer raise a TestError
  Regressions report pass but number of tests has gone done on some simulators. Icarus for instance shows this.
  
  ```
  0.00ns [34mINFO    [39m cocotb.gpi                                  gpi_embed.c:213  in embed_sim_init                  [34mRunning on Icarus Verilog version 0.10.0 (devel)[39m
       0.00ns [34mINFO    [39m cocotb.gpi                                  gpi_embed.c:214  in embed_sim_init                  [34mPython interpreter initialised and cocotb loaded![39m
       0.00ns [34mINFO    [39m cocotb.gpi                                  __init__.py:96   in _initialise_testbench           [34mSeeding Python random module with 1421853826[39m
       0.00ns [34mINFO    [39m cocotb.gpi                                  __init__.py:110  in _initialise_testbench           [34mRunning tests with Cocotb v0.5a from /var/lib/jenkins/workspace/cocotb_icarus_x86_64[39m
       0.00ns [31mERROR   [39m cocotb.coroutine.fail                     decorators.py:99   in __init__                        [31mtest_duplicate_yield isn't a value coroutine! Did you use the yield keyword?[39m
  Traceback (most recent call last):
    File "/var/lib/jenkins/workspace/cocotb_icarus_x86_64/cocotb/__init__.py", line 128, in _initialise_testbench
      regression.initialise()
    File "/var/lib/jenkins/workspace/cocotb_icarus_x86_64/cocotb/regression.py", line 123, in initialise
      test = thing(self._dut)
    File "/var/lib/jenkins/workspace/cocotb_icarus_x86_64/cocotb/decorators.py", line 356, in _wrapped_test
      raise_error(self, str(e))
    File "/var/lib/jenkins/workspace/cocotb_icarus_x86_64/cocotb/result.py", line 42, in raise_error
      if sys.version_info.major >= 3:
  AttributeError: 'tuple' object has no attribute 'major'
  ```
  
  
  </issue>
  <code>
  [start of cocotb/result.py]
  1 ''' Copyright (c) 2013 Potential Ventures Ltd
  2 Copyright (c) 2013 SolarFlare Communications Inc
  3 All rights reserved.
  4 
  5 Redistribution and use in source and binary forms, with or without
  6 modification, are permitted provided that the following conditions are met:
  7     * Redistributions of source code must retain the above copyright
  8       notice, this list of conditions and the following disclaimer.
  9     * Redistributions in binary form must reproduce the above copyright
  10       notice, this list of conditions and the following disclaimer in the
  11       documentation and/or other materials provided with the distribution.
  12     * Neither the name of Potential Ventures Ltd,
  13       SolarFlare Communications Inc nor the
  14       names of its contributors may be used to endorse or promote products
  15       derived from this software without specific prior written permission.
  16 
  17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20 DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
  21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. '''
  27 
  28 # TODO: Coule use cStringIO?
  29 import traceback
  30 import sys
  31 #from StringIO import StringIO
  32 from io import StringIO, BytesIO
  33 
  34 def raise_error(obj, msg):
  35     """
  36     Creates a TestError exception and raises it after printing a traceback
  37 
  38         obj has a log method
  39         msg is a string
  40     """
  41     exc_type, exc_value, exc_traceback = sys.exc_info()
  42     if sys.version_info.major >= 3:
  43         buff = StringIO()
  44         traceback.print_tb(exc_traceback, file=buff)
  45     else:
  46         buff_bytes = BytesIO()
  47         traceback.print_tb(exc_traceback, file=buff_bytes)
  48         buff = StringIO(buff_bytes.getvalue().decode("UTF-8"))
  49     obj.log.error("%s\n%s" % (msg, buff.getvalue()))
  50     exception = TestError(msg)
  51     exception.stderr.write(buff.getvalue())
  52     raise exception
  53 
  54 def create_error(obj, msg):
  55     """
  56     As above, but return the exception rather than raise it, simply to avoid
  57     too many levels of nested try/except blocks
  58     """
  59     try:
  60         raise_error(obj, msg)
  61     except TestError as error:
  62         return error
  63     return TestError("Creating error traceback failed")
  64 
  65 
  66 class ReturnValue(StopIteration):
  67     def __init__(self, retval):
  68         self.retval = retval
  69 
  70 class TestComplete(StopIteration):
  71     """
  72         Exceptions are used to pass test results around.
  73     """
  74     def __init__(self, *args, **kwargs):
  75         super(TestComplete, self).__init__(*args, **kwargs)
  76         self.stdout = StringIO()
  77         self.stderr = StringIO()
  78 
  79 class TestError(TestComplete): pass
  80 
  81 class TestFailure(TestComplete): pass
  82 
  83 class TestSuccess(TestComplete): pass
  84 
  85 class SimFailure(TestComplete): pass
  86
  [end of cocotb/result.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/cocotb/result.py b/cocotb/result.py
  --- a/cocotb/result.py
  +++ b/cocotb/result.py
  @@ -39,7 +39,8 @@
           msg is a string
       """
       exc_type, exc_value, exc_traceback = sys.exc_info()
  -    if sys.version_info.major >= 3:
  +    # 2.6 cannot use named access
  +    if sys.version_info[0] >= 3:
           buff = StringIO()
           traceback.print_tb(exc_traceback, file=buff)
       else:
  
verification_info: {"golden_diff": "diff --git a/cocotb/result.py b/cocotb/result.py\n--- a/cocotb/result.py\n+++ b/cocotb/result.py\n@@ -39,7 +39,8 @@\n         msg is a string\n     \"\"\"\n     exc_type, exc_value, exc_traceback = sys.exc_info()\n-    if sys.version_info.major >= 3:\n+    # 2.6 cannot use named access\n+    if sys.version_info[0] >= 3:\n         buff = StringIO()\n         traceback.print_tb(exc_traceback, file=buff)\n     else:\n", "issue": "Redhat 6.5 can no longer raise a TestError\nRegressions report pass but number of tests has gone done on some simulators. Icarus for instance shows this.\n\n```\n0.00ns \u001b[34mINFO    \u001b[39m cocotb.gpi                                  gpi_embed.c:213  in embed_sim_init                  \u001b[34mRunning on Icarus Verilog version 0.10.0 (devel)\u001b[39m\n     0.00ns \u001b[34mINFO    \u001b[39m cocotb.gpi                                  gpi_embed.c:214  in embed_sim_init                  \u001b[34mPython interpreter initialised and cocotb loaded!\u001b[39m\n     0.00ns \u001b[34mINFO    \u001b[39m cocotb.gpi                                  __init__.py:96   in _initialise_testbench           \u001b[34mSeeding Python random module with 1421853826\u001b[39m\n     0.00ns \u001b[34mINFO    \u001b[39m cocotb.gpi                                  __init__.py:110  in _initialise_testbench           \u001b[34mRunning tests with Cocotb v0.5a from /var/lib/jenkins/workspace/cocotb_icarus_x86_64\u001b[39m\n     0.00ns \u001b[31mERROR   \u001b[39m cocotb.coroutine.fail                     decorators.py:99   in __init__                        \u001b[31mtest_duplicate_yield isn't a value coroutine! Did you use the yield keyword?\u001b[39m\nTraceback (most recent call last):\n  File \"/var/lib/jenkins/workspace/cocotb_icarus_x86_64/cocotb/__init__.py\", line 128, in _initialise_testbench\n    regression.initialise()\n  File \"/var/lib/jenkins/workspace/cocotb_icarus_x86_64/cocotb/regression.py\", line 123, in initialise\n    test = thing(self._dut)\n  File \"/var/lib/jenkins/workspace/cocotb_icarus_x86_64/cocotb/decorators.py\", line 356, in _wrapped_test\n    raise_error(self, str(e))\n  File \"/var/lib/jenkins/workspace/cocotb_icarus_x86_64/cocotb/result.py\", line 42, in raise_error\n    if sys.version_info.major >= 3:\nAttributeError: 'tuple' object has no attribute 'major'\n```\n\n", "before_files": [{"content": "''' Copyright (c) 2013 Potential Ventures Ltd\nCopyright (c) 2013 SolarFlare Communications Inc\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the name of Potential Ventures Ltd,\n      SolarFlare Communications Inc nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. '''\n\n# TODO: Coule use cStringIO?\nimport traceback\nimport sys\n#from StringIO import StringIO\nfrom io import StringIO, BytesIO\n\ndef raise_error(obj, msg):\n    \"\"\"\n    Creates a TestError exception and raises it after printing a traceback\n\n        obj has a log method\n        msg is a string\n    \"\"\"\n    exc_type, exc_value, exc_traceback = sys.exc_info()\n    if sys.version_info.major >= 3:\n        buff = StringIO()\n        traceback.print_tb(exc_traceback, file=buff)\n    else:\n        buff_bytes = BytesIO()\n        traceback.print_tb(exc_traceback, file=buff_bytes)\n        buff = StringIO(buff_bytes.getvalue().decode(\"UTF-8\"))\n    obj.log.error(\"%s\\n%s\" % (msg, buff.getvalue()))\n    exception = TestError(msg)\n    exception.stderr.write(buff.getvalue())\n    raise exception\n\ndef create_error(obj, msg):\n    \"\"\"\n    As above, but return the exception rather than raise it, simply to avoid\n    too many levels of nested try/except blocks\n    \"\"\"\n    try:\n        raise_error(obj, msg)\n    except TestError as error:\n        return error\n    return TestError(\"Creating error traceback failed\")\n\n\nclass ReturnValue(StopIteration):\n    def __init__(self, retval):\n        self.retval = retval\n\nclass TestComplete(StopIteration):\n    \"\"\"\n        Exceptions are used to pass test results around.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        super(TestComplete, self).__init__(*args, **kwargs)\n        self.stdout = StringIO()\n        self.stderr = StringIO()\n\nclass TestError(TestComplete): pass\n\nclass TestFailure(TestComplete): pass\n\nclass TestSuccess(TestComplete): pass\n\nclass SimFailure(TestComplete): pass\n", "path": "cocotb/result.py"}]}