We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Disallow int128->int128 conversion.
### What's your issue about?

Disallow`int128` to be converted to `int128`, follows https://github.com/ethereum/vyper/pull/882.

### How can it be fixed?

Fill this in if you know how to fix it.

#### Cute Animal Picture
![](https://peopledotcom.files.wordpress.com/2011/06/panda-660.jpg)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `vyper/types/convert.py`
Content:
```
1 from vyper.functions.signature import (
2     signature
3 )
4 from vyper.parser.parser_utils import (
5     LLLnode,
6     getpos,
7     byte_array_to_num
8 )
9 from vyper.exceptions import (
10     InvalidLiteralException,
11     TypeMismatchException,
12 )
13 from vyper.types import (
14     BaseType,
15 )
16 from vyper.types import (
17     get_type,
18 )
19 from vyper.utils import (
20     DECIMAL_DIVISOR,
21     MemoryPositions,
22     SizeLimits
23 )
24 
25 
26 @signature(('int128', 'uint256', 'bytes32', 'bytes'), 'str_literal')
27 def to_int128(expr, args, kwargs, context):
28     in_node = args[0]
29     typ, len = get_type(in_node)
30     if typ in ('int128', 'uint256', 'bytes32'):
31         if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):
32             raise InvalidLiteralException("Number out of range: {}".format(in_node.value), expr)
33         return LLLnode.from_list(
34             ['clamp', ['mload', MemoryPositions.MINNUM], in_node,
35                         ['mload', MemoryPositions.MAXNUM]], typ=BaseType('int128', in_node.typ.unit), pos=getpos(expr)
36         )
37     else:
38         return byte_array_to_num(in_node, expr, 'int128')
39 
40 
41 @signature(('num_literal', 'int128', 'bytes32'), 'str_literal')
42 def to_uint256(expr, args, kwargs, context):
43     in_node = args[0]
44     typ, len = get_type(in_node)
45     if isinstance(in_node, int):
46 
47         if not SizeLimits.in_bounds('uint256', in_node):
48             raise InvalidLiteralException("Number out of range: {}".format(in_node))
49         _unit = in_node.typ.unit if typ == 'int128' else None
50         return LLLnode.from_list(in_node, typ=BaseType('uint256', _unit), pos=getpos(expr))
51     elif isinstance(in_node, LLLnode) and typ in ('int128', 'num_literal'):
52         _unit = in_node.typ.unit if typ == 'int128' else None
53         return LLLnode.from_list(['clampge', in_node, 0], typ=BaseType('uint256', _unit), pos=getpos(expr))
54     elif isinstance(in_node, LLLnode) and typ in ('bytes32'):
55         return LLLnode(value=in_node.value, args=in_node.args, typ=BaseType('uint256'), pos=getpos(expr))
56     else:
57         raise InvalidLiteralException("Invalid input for uint256: %r" % in_node, expr)
58 
59 
60 @signature(('int128', 'uint256'), 'str_literal')
61 def to_decimal(expr, args, kwargs, context):
62     input = args[0]
63     if input.typ.typ == 'uint256':
64         return LLLnode.from_list(
65             ['uclample', ['mul', input, DECIMAL_DIVISOR], ['mload', MemoryPositions.MAXDECIMAL]],
66             typ=BaseType('decimal', input.typ.unit, input.typ.positional), pos=getpos(expr)
67         )
68     else:
69         return LLLnode.from_list(
70             ['mul', input, DECIMAL_DIVISOR],
71             typ=BaseType('decimal', input.typ.unit, input.typ.positional),
72             pos=getpos(expr)
73         )
74 
75 
76 @signature(('int128', 'uint256', 'address', 'bytes'), 'str_literal')
77 def to_bytes32(expr, args, kwargs, context):
78     input = args[0]
79     typ, len = get_type(input)
80     if typ == 'bytes':
81         if len != 32:
82             raise TypeMismatchException("Unable to convert bytes[{}] to bytes32".format(len))
83         if input.location == "memory":
84             return LLLnode.from_list(
85             ['mload', ['add', input, 32]], typ=BaseType('bytes32')
86             )
87         elif input.location == "storage":
88             return LLLnode.from_list(
89                 ['sload', ['add', ['sha3_32', input], 1]], typ=BaseType('bytes32')
90             )
91     else:
92         return LLLnode(value=input.value, args=input.args, typ=BaseType('bytes32'), pos=getpos(expr))
93 
94 
95 def convert(expr, context):
96     output_type = expr.args[1].s
97     if output_type in conversion_table:
98         return conversion_table[output_type](expr, context)
99     else:
100         raise Exception("Conversion to {} is invalid.".format(output_type))
101 
102 
103 conversion_table = {
104     'int128': to_int128,
105     'uint256': to_uint256,
106     'decimal': to_decimal,
107     'bytes32': to_bytes32,
108 }
109
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/vyper/types/convert.py b/vyper/types/convert.py
--- a/vyper/types/convert.py
+++ b/vyper/types/convert.py
@@ -23,11 +23,11 @@
 )
 
 
-@signature(('int128', 'uint256', 'bytes32', 'bytes'), 'str_literal')
+@signature(('uint256', 'bytes32', 'bytes'), 'str_literal')
 def to_int128(expr, args, kwargs, context):
     in_node = args[0]
     typ, len = get_type(in_node)
-    if typ in ('int128', 'uint256', 'bytes32'):
+    if typ in ('uint256', 'bytes32'):
         if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):
             raise InvalidLiteralException("Number out of range: {}".format(in_node.value), expr)
         return LLLnode.from_list(

{"golden_diff": "diff --git a/vyper/types/convert.py b/vyper/types/convert.py\n--- a/vyper/types/convert.py\n+++ b/vyper/types/convert.py\n@@ -23,11 +23,11 @@\n )\n \n \n-@signature(('int128', 'uint256', 'bytes32', 'bytes'), 'str_literal')\n+@signature(('uint256', 'bytes32', 'bytes'), 'str_literal')\n def to_int128(expr, args, kwargs, context):\n     in_node = args[0]\n     typ, len = get_type(in_node)\n-    if typ in ('int128', 'uint256', 'bytes32'):\n+    if typ in ('uint256', 'bytes32'):\n         if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):\n             raise InvalidLiteralException(\"Number out of range: {}\".format(in_node.value), expr)\n         return LLLnode.from_list(\n", "issue": "Disallow int128->int128 conversion.\n### What's your issue about?\r\n\r\nDisallow`int128` to be converted to `int128`, follows https://github.com/ethereum/vyper/pull/882.\r\n\r\n### How can it be fixed?\r\n\r\nFill this in if you know how to fix it.\r\n\r\n#### Cute Animal Picture\r\n![](https://peopledotcom.files.wordpress.com/2011/06/panda-660.jpg)\r\n\n", "before_files": [{"content": "from vyper.functions.signature import (\n    signature\n)\nfrom vyper.parser.parser_utils import (\n    LLLnode,\n    getpos,\n    byte_array_to_num\n)\nfrom vyper.exceptions import (\n    InvalidLiteralException,\n    TypeMismatchException,\n)\nfrom vyper.types import (\n    BaseType,\n)\nfrom vyper.types import (\n    get_type,\n)\nfrom vyper.utils import (\n    DECIMAL_DIVISOR,\n    MemoryPositions,\n    SizeLimits\n)\n\n\n@signature(('int128', 'uint256', 'bytes32', 'bytes'), 'str_literal')\ndef to_int128(expr, args, kwargs, context):\n    in_node = args[0]\n    typ, len = get_type(in_node)\n    if typ in ('int128', 'uint256', 'bytes32'):\n        if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):\n            raise InvalidLiteralException(\"Number out of range: {}\".format(in_node.value), expr)\n        return LLLnode.from_list(\n            ['clamp', ['mload', MemoryPositions.MINNUM], in_node,\n                        ['mload', MemoryPositions.MAXNUM]], typ=BaseType('int128', in_node.typ.unit), pos=getpos(expr)\n        )\n    else:\n        return byte_array_to_num(in_node, expr, 'int128')\n\n\n@signature(('num_literal', 'int128', 'bytes32'), 'str_literal')\ndef to_uint256(expr, args, kwargs, context):\n    in_node = args[0]\n    typ, len = get_type(in_node)\n    if isinstance(in_node, int):\n\n        if not SizeLimits.in_bounds('uint256', in_node):\n            raise InvalidLiteralException(\"Number out of range: {}\".format(in_node))\n        _unit = in_node.typ.unit if typ == 'int128' else None\n        return LLLnode.from_list(in_node, typ=BaseType('uint256', _unit), pos=getpos(expr))\n    elif isinstance(in_node, LLLnode) and typ in ('int128', 'num_literal'):\n        _unit = in_node.typ.unit if typ == 'int128' else None\n        return LLLnode.from_list(['clampge', in_node, 0], typ=BaseType('uint256', _unit), pos=getpos(expr))\n    elif isinstance(in_node, LLLnode) and typ in ('bytes32'):\n        return LLLnode(value=in_node.value, args=in_node.args, typ=BaseType('uint256'), pos=getpos(expr))\n    else:\n        raise InvalidLiteralException(\"Invalid input for uint256: %r\" % in_node, expr)\n\n\n@signature(('int128', 'uint256'), 'str_literal')\ndef to_decimal(expr, args, kwargs, context):\n    input = args[0]\n    if input.typ.typ == 'uint256':\n        return LLLnode.from_list(\n            ['uclample', ['mul', input, DECIMAL_DIVISOR], ['mload', MemoryPositions.MAXDECIMAL]],\n            typ=BaseType('decimal', input.typ.unit, input.typ.positional), pos=getpos(expr)\n        )\n    else:\n        return LLLnode.from_list(\n            ['mul', input, DECIMAL_DIVISOR],\n            typ=BaseType('decimal', input.typ.unit, input.typ.positional),\n            pos=getpos(expr)\n        )\n\n\n@signature(('int128', 'uint256', 'address', 'bytes'), 'str_literal')\ndef to_bytes32(expr, args, kwargs, context):\n    input = args[0]\n    typ, len = get_type(input)\n    if typ == 'bytes':\n        if len != 32:\n            raise TypeMismatchException(\"Unable to convert bytes[{}] to bytes32\".format(len))\n        if input.location == \"memory\":\n            return LLLnode.from_list(\n            ['mload', ['add', input, 32]], typ=BaseType('bytes32')\n            )\n        elif input.location == \"storage\":\n            return LLLnode.from_list(\n                ['sload', ['add', ['sha3_32', input], 1]], typ=BaseType('bytes32')\n            )\n    else:\n        return LLLnode(value=input.value, args=input.args, typ=BaseType('bytes32'), pos=getpos(expr))\n\n\ndef convert(expr, context):\n    output_type = expr.args[1].s\n    if output_type in conversion_table:\n        return conversion_table[output_type](expr, context)\n    else:\n        raise Exception(\"Conversion to {} is invalid.\".format(output_type))\n\n\nconversion_table = {\n    'int128': to_int128,\n    'uint256': to_uint256,\n    'decimal': to_decimal,\n    'bytes32': to_bytes32,\n}\n", "path": "vyper/types/convert.py"}], "after_files": [{"content": "from vyper.functions.signature import (\n    signature\n)\nfrom vyper.parser.parser_utils import (\n    LLLnode,\n    getpos,\n    byte_array_to_num\n)\nfrom vyper.exceptions import (\n    InvalidLiteralException,\n    TypeMismatchException,\n)\nfrom vyper.types import (\n    BaseType,\n)\nfrom vyper.types import (\n    get_type,\n)\nfrom vyper.utils import (\n    DECIMAL_DIVISOR,\n    MemoryPositions,\n    SizeLimits\n)\n\n\n@signature(('uint256', 'bytes32', 'bytes'), 'str_literal')\ndef to_int128(expr, args, kwargs, context):\n    in_node = args[0]\n    typ, len = get_type(in_node)\n    if typ in ('uint256', 'bytes32'):\n        if in_node.typ.is_literal and not SizeLimits.in_bounds('int128', in_node.value):\n            raise InvalidLiteralException(\"Number out of range: {}\".format(in_node.value), expr)\n        return LLLnode.from_list(\n            ['clamp', ['mload', MemoryPositions.MINNUM], in_node,\n                        ['mload', MemoryPositions.MAXNUM]], typ=BaseType('int128', in_node.typ.unit), pos=getpos(expr)\n        )\n    else:\n        return byte_array_to_num(in_node, expr, 'int128')\n\n\n@signature(('num_literal', 'int128', 'bytes32'), 'str_literal')\ndef to_uint256(expr, args, kwargs, context):\n    in_node = args[0]\n    typ, len = get_type(in_node)\n    if isinstance(in_node, int):\n\n        if not SizeLimits.in_bounds('uint256', in_node):\n            raise InvalidLiteralException(\"Number out of range: {}\".format(in_node))\n        _unit = in_node.typ.unit if typ == 'int128' else None\n        return LLLnode.from_list(in_node, typ=BaseType('uint256', _unit), pos=getpos(expr))\n    elif isinstance(in_node, LLLnode) and typ in ('int128', 'num_literal'):\n        _unit = in_node.typ.unit if typ == 'int128' else None\n        return LLLnode.from_list(['clampge', in_node, 0], typ=BaseType('uint256', _unit), pos=getpos(expr))\n    elif isinstance(in_node, LLLnode) and typ in ('bytes32'):\n        return LLLnode(value=in_node.value, args=in_node.args, typ=BaseType('uint256'), pos=getpos(expr))\n    else:\n        raise InvalidLiteralException(\"Invalid input for uint256: %r\" % in_node, expr)\n\n\n@signature(('int128', 'uint256'), 'str_literal')\ndef to_decimal(expr, args, kwargs, context):\n    input = args[0]\n    if input.typ.typ == 'uint256':\n        return LLLnode.from_list(\n            ['uclample', ['mul', input, DECIMAL_DIVISOR], ['mload', MemoryPositions.MAXDECIMAL]],\n            typ=BaseType('decimal', input.typ.unit, input.typ.positional), pos=getpos(expr)\n        )\n    else:\n        return LLLnode.from_list(\n            ['mul', input, DECIMAL_DIVISOR],\n            typ=BaseType('decimal', input.typ.unit, input.typ.positional),\n            pos=getpos(expr)\n        )\n\n\n@signature(('int128', 'uint256', 'address', 'bytes'), 'str_literal')\ndef to_bytes32(expr, args, kwargs, context):\n    input = args[0]\n    typ, len = get_type(input)\n    if typ == 'bytes':\n        if len != 32:\n            raise TypeMismatchException(\"Unable to convert bytes[{}] to bytes32\".format(len))\n        if input.location == \"memory\":\n            return LLLnode.from_list(\n            ['mload', ['add', input, 32]], typ=BaseType('bytes32')\n            )\n        elif input.location == \"storage\":\n            return LLLnode.from_list(\n                ['sload', ['add', ['sha3_32', input], 1]], typ=BaseType('bytes32')\n            )\n    else:\n        return LLLnode(value=input.value, args=input.args, typ=BaseType('bytes32'), pos=getpos(expr))\n\n\ndef convert(expr, context):\n    output_type = expr.args[1].s\n    if output_type in conversion_table:\n        return conversion_table[output_type](expr, context)\n    else:\n        raise Exception(\"Conversion to {} is invalid.\".format(output_type))\n\n\nconversion_table = {\n    'int128': to_int128,\n    'uint256': to_uint256,\n    'decimal': to_decimal,\n    'bytes32': to_bytes32,\n}\n", "path": "vyper/types/convert.py"}]}