prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  raises_unsupported_algorithm gives very unhelpful errors
  When the error tag is wrong you get errors along the lines of `assert <object object at 0xf0000000> is not <object object as 0xb0000000>`. This is not very helpful, it's not even particularly obvious that the error tag is actually what's wrong until you go and read the code.
  
  Should probably generate a useful error message or somehow give the tag objects a more useful `repr` output.
  
  
  </issue>
  <code>
  [start of src/cryptography/exceptions.py]
  1 # This file is dual licensed under the terms of the Apache License, Version
  2 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
  3 # for complete details.
  4 
  5 from __future__ import absolute_import, division, print_function
  6 
  7 
  8 class _Reasons(object):
  9     BACKEND_MISSING_INTERFACE = object()
  10     UNSUPPORTED_HASH = object()
  11     UNSUPPORTED_CIPHER = object()
  12     UNSUPPORTED_PADDING = object()
  13     UNSUPPORTED_MGF = object()
  14     UNSUPPORTED_PUBLIC_KEY_ALGORITHM = object()
  15     UNSUPPORTED_ELLIPTIC_CURVE = object()
  16     UNSUPPORTED_SERIALIZATION = object()
  17     UNSUPPORTED_X509 = object()
  18 
  19 
  20 class UnsupportedAlgorithm(Exception):
  21     def __init__(self, message, reason=None):
  22         super(UnsupportedAlgorithm, self).__init__(message)
  23         self._reason = reason
  24 
  25 
  26 class AlreadyFinalized(Exception):
  27     pass
  28 
  29 
  30 class AlreadyUpdated(Exception):
  31     pass
  32 
  33 
  34 class NotYetFinalized(Exception):
  35     pass
  36 
  37 
  38 class InvalidTag(Exception):
  39     pass
  40 
  41 
  42 class InvalidSignature(Exception):
  43     pass
  44 
  45 
  46 class InternalError(Exception):
  47     pass
  48 
  49 
  50 class InvalidKey(Exception):
  51     pass
  52 
  53 
  54 class InvalidToken(Exception):
  55     pass
  56
  [end of src/cryptography/exceptions.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/src/cryptography/exceptions.py b/src/cryptography/exceptions.py
  --- a/src/cryptography/exceptions.py
  +++ b/src/cryptography/exceptions.py
  @@ -4,17 +4,19 @@
   
   from __future__ import absolute_import, division, print_function
   
  -
  -class _Reasons(object):
  -    BACKEND_MISSING_INTERFACE = object()
  -    UNSUPPORTED_HASH = object()
  -    UNSUPPORTED_CIPHER = object()
  -    UNSUPPORTED_PADDING = object()
  -    UNSUPPORTED_MGF = object()
  -    UNSUPPORTED_PUBLIC_KEY_ALGORITHM = object()
  -    UNSUPPORTED_ELLIPTIC_CURVE = object()
  -    UNSUPPORTED_SERIALIZATION = object()
  -    UNSUPPORTED_X509 = object()
  +from enum import Enum
  +
  +
  +class _Reasons(Enum):
  +    BACKEND_MISSING_INTERFACE = 0
  +    UNSUPPORTED_HASH = 1
  +    UNSUPPORTED_CIPHER = 2
  +    UNSUPPORTED_PADDING = 3
  +    UNSUPPORTED_MGF = 4
  +    UNSUPPORTED_PUBLIC_KEY_ALGORITHM = 5
  +    UNSUPPORTED_ELLIPTIC_CURVE = 6
  +    UNSUPPORTED_SERIALIZATION = 7
  +    UNSUPPORTED_X509 = 8
   
   
   class UnsupportedAlgorithm(Exception):
  
verification_info: {"golden_diff": "diff --git a/src/cryptography/exceptions.py b/src/cryptography/exceptions.py\n--- a/src/cryptography/exceptions.py\n+++ b/src/cryptography/exceptions.py\n@@ -4,17 +4,19 @@\n \n from __future__ import absolute_import, division, print_function\n \n-\n-class _Reasons(object):\n-    BACKEND_MISSING_INTERFACE = object()\n-    UNSUPPORTED_HASH = object()\n-    UNSUPPORTED_CIPHER = object()\n-    UNSUPPORTED_PADDING = object()\n-    UNSUPPORTED_MGF = object()\n-    UNSUPPORTED_PUBLIC_KEY_ALGORITHM = object()\n-    UNSUPPORTED_ELLIPTIC_CURVE = object()\n-    UNSUPPORTED_SERIALIZATION = object()\n-    UNSUPPORTED_X509 = object()\n+from enum import Enum\n+\n+\n+class _Reasons(Enum):\n+    BACKEND_MISSING_INTERFACE = 0\n+    UNSUPPORTED_HASH = 1\n+    UNSUPPORTED_CIPHER = 2\n+    UNSUPPORTED_PADDING = 3\n+    UNSUPPORTED_MGF = 4\n+    UNSUPPORTED_PUBLIC_KEY_ALGORITHM = 5\n+    UNSUPPORTED_ELLIPTIC_CURVE = 6\n+    UNSUPPORTED_SERIALIZATION = 7\n+    UNSUPPORTED_X509 = 8\n \n \n class UnsupportedAlgorithm(Exception):\n", "issue": "raises_unsupported_algorithm gives very unhelpful errors\nWhen the error tag is wrong you get errors along the lines of `assert <object object at 0xf0000000> is not <object object as 0xb0000000>`. This is not very helpful, it's not even particularly obvious that the error tag is actually what's wrong until you go and read the code.\n\nShould probably generate a useful error message or somehow give the tag objects a more useful `repr` output.\n\n", "before_files": [{"content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nfrom __future__ import absolute_import, division, print_function\n\n\nclass _Reasons(object):\n    BACKEND_MISSING_INTERFACE = object()\n    UNSUPPORTED_HASH = object()\n    UNSUPPORTED_CIPHER = object()\n    UNSUPPORTED_PADDING = object()\n    UNSUPPORTED_MGF = object()\n    UNSUPPORTED_PUBLIC_KEY_ALGORITHM = object()\n    UNSUPPORTED_ELLIPTIC_CURVE = object()\n    UNSUPPORTED_SERIALIZATION = object()\n    UNSUPPORTED_X509 = object()\n\n\nclass UnsupportedAlgorithm(Exception):\n    def __init__(self, message, reason=None):\n        super(UnsupportedAlgorithm, self).__init__(message)\n        self._reason = reason\n\n\nclass AlreadyFinalized(Exception):\n    pass\n\n\nclass AlreadyUpdated(Exception):\n    pass\n\n\nclass NotYetFinalized(Exception):\n    pass\n\n\nclass InvalidTag(Exception):\n    pass\n\n\nclass InvalidSignature(Exception):\n    pass\n\n\nclass InternalError(Exception):\n    pass\n\n\nclass InvalidKey(Exception):\n    pass\n\n\nclass InvalidToken(Exception):\n    pass\n", "path": "src/cryptography/exceptions.py"}]}