We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
opcode LIST_EXTEND not allowed
Python 3.9.0 brings new opcode [`LIST_EXTEND`](https://docs.python.org/3/library/dis.html#opcode-LIST_EXTEND), which leads to an error during `pwn` import:

```
$ cat ~/.pwn.conf
[context]
terminal = ['alacritty', '-e', 'sh', '-c']
$ ipython
Python 3.9.0 (default, Oct  7 2020, 23:09:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import pwn
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-85301d96339b> in <module>
----> 1 import pwn

~/src/pwntools/pwn/toplevel.py in <module>
      6 pwnlib.args.initialize()
      7 pwnlib.log.install_default_handler()
----> 8 pwnlib.config.initialize()
      9
     10 log = pwnlib.log.getLogger('pwnlib.exploit')

~/src/pwntools/pwnlib/config.py in initialize()
     62             continue
     63         settings = dict(c.items(section))
---> 64         registered_configs[section](settings)

~/src/pwntools/pwnlib/context/__init__.py in update_context_defaults(section)
   1491
   1492         if isinstance(default, six.string_types + six.integer_types + (tuple, list, dict)):
-> 1493             value = safeeval.expr(value)
   1494         else:
   1495             log.warn("Unsupported configuration option %r in section %r" % (key, 'context'))

~/src/pwntools/pwnlib/util/safeeval.py in expr(expr)
    109     """
    110
--> 111     c = test_expr(expr, _expr_codes)
    112     return eval(c)
    113

~/src/pwntools/pwnlib/util/safeeval.py in test_expr(expr, allowed_codes)
     61     for code in codes:
     62         if code not in allowed_codes:
---> 63             raise ValueError("opcode %s not allowed" % dis.opname[code])
     64     return c
     65

ValueError: opcode LIST_EXTEND not allowed
```

Adding `'LIST_EXTEND'` to [`_const_codes`](https://github.com/Gallopsled/pwntools/blob/db8df476b2bed695dea14eb726b45237b972811f/pwnlib/util/safeeval.py#L3) or [`_expr_codes`](https://github.com/Gallopsled/pwntools/blob/db8df476b2bed695dea14eb726b45237b972811f/pwnlib/util/safeeval.py#L9) seems to solve the issue, but I'm not familiar with this code.

Also, there are more new opcodes: `LIST_TO_TUPLE`, `SET_UPDATE`, etc.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pwnlib/util/safeeval.py`
Content:
```
1 from __future__ import division
2 
3 _const_codes = [
4     'POP_TOP','ROT_TWO','ROT_THREE','ROT_FOUR','DUP_TOP',
5     'BUILD_LIST','BUILD_MAP','BUILD_TUPLE','BUILD_SET',
6     'LOAD_CONST','RETURN_VALUE','STORE_SUBSCR', 'STORE_MAP'
7     ]
8 
9 _expr_codes = _const_codes + [
10     'UNARY_POSITIVE','UNARY_NEGATIVE','UNARY_NOT',
11     'UNARY_INVERT','BINARY_POWER','BINARY_MULTIPLY',
12     'BINARY_DIVIDE','BINARY_FLOOR_DIVIDE','BINARY_TRUE_DIVIDE',
13     'BINARY_MODULO','BINARY_ADD','BINARY_SUBTRACT',
14     'BINARY_LSHIFT','BINARY_RSHIFT','BINARY_AND','BINARY_XOR',
15     'BINARY_OR',
16     ]
17 
18 _values_codes = _expr_codes + ['LOAD_NAME']
19 
20 import six
21 
22 def _get_opcodes(codeobj):
23     """_get_opcodes(codeobj) -> [opcodes]
24 
25     Extract the actual opcodes as a list from a code object
26 
27     >>> c = compile("[1 + 2, (1,2)]", "", "eval")
28     >>> _get_opcodes(c)
29     [100, 100, 103, 83]
30     """
31     import dis
32     if hasattr(dis, 'get_instructions'):
33         return [ins.opcode for ins in dis.get_instructions(codeobj)]
34     i = 0
35     opcodes = []
36     s = codeobj.co_code
37     while i < len(s):
38         code = six.indexbytes(s, i)
39         opcodes.append(code)
40         if code >= dis.HAVE_ARGUMENT:
41             i += 3
42         else:
43             i += 1
44     return opcodes
45 
46 def test_expr(expr, allowed_codes):
47     """test_expr(expr, allowed_codes) -> codeobj
48 
49     Test that the expression contains only the listed opcodes.
50     If the expression is valid and contains only allowed codes,
51     return the compiled code object. Otherwise raise a ValueError
52     """
53     import dis
54     allowed_codes = [dis.opmap[c] for c in allowed_codes if c in dis.opmap]
55     try:
56         c = compile(expr, "", "eval")
57     except SyntaxError:
58         raise ValueError("%s is not a valid expression" % expr)
59     codes = _get_opcodes(c)
60     for code in codes:
61         if code not in allowed_codes:
62             raise ValueError("opcode %s not allowed" % dis.opname[code])
63     return c
64 
65 def const(expr):
66     """const(expression) -> value
67 
68     Safe Python constant evaluation
69 
70     Evaluates a string that contains an expression describing
71     a Python constant. Strings that are not valid Python expressions
72     or that contain other code besides the constant raise ValueError.
73 
74     Examples:
75 
76         >>> const("10")
77         10
78         >>> const("[1,2, (3,4), {'foo':'bar'}]")
79         [1, 2, (3, 4), {'foo': 'bar'}]
80         >>> const("[1]+[2]")
81         Traceback (most recent call last):
82         ...
83         ValueError: opcode BINARY_ADD not allowed
84     """
85 
86     c = test_expr(expr, _const_codes)
87     return eval(c)
88 
89 def expr(expr):
90     """expr(expression) -> value
91 
92     Safe Python expression evaluation
93 
94     Evaluates a string that contains an expression that only
95     uses Python constants. This can be used to e.g. evaluate
96     a numerical expression from an untrusted source.
97 
98     Examples:
99 
100         >>> expr("1+2")
101         3
102         >>> expr("[1,2]*2")
103         [1, 2, 1, 2]
104         >>> expr("__import__('sys').modules")
105         Traceback (most recent call last):
106         ...
107         ValueError: opcode LOAD_NAME not allowed
108     """
109 
110     c = test_expr(expr, _expr_codes)
111     return eval(c)
112 
113 def values(expr, env):
114     """values(expression, dict) -> value
115 
116     Safe Python expression evaluation
117 
118     Evaluates a string that contains an expression that only
119     uses Python constants and values from a supplied dictionary.
120     This can be used to e.g. evaluate e.g. an argument to a syscall.
121 
122     Note: This is potentially unsafe if e.g. the __add__ method has side
123           effects.
124 
125     Examples:
126 
127         >>> values("A + 4", {'A': 6})
128         10
129         >>> class Foo:
130         ...    def __add__(self, other):
131         ...        print("Firing the missiles")
132         >>> values("A + 1", {'A': Foo()})
133         Firing the missiles
134         >>> values("A.x", {'A': Foo()})
135         Traceback (most recent call last):
136         ...
137         ValueError: opcode LOAD_ATTR not allowed
138     """
139 
140     # The caller might need his dictionary again
141     env = dict(env)
142 
143     # We do not want to have built-ins set
144     env['__builtins__'] = {}
145 
146     c = test_expr(expr, _values_codes)
147     return eval(c, env)
148
```
--- 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/pwnlib/util/safeeval.py b/pwnlib/util/safeeval.py
--- a/pwnlib/util/safeeval.py
+++ b/pwnlib/util/safeeval.py
@@ -3,7 +3,9 @@
 _const_codes = [
     'POP_TOP','ROT_TWO','ROT_THREE','ROT_FOUR','DUP_TOP',
     'BUILD_LIST','BUILD_MAP','BUILD_TUPLE','BUILD_SET',
-    'LOAD_CONST','RETURN_VALUE','STORE_SUBSCR', 'STORE_MAP'
+    'BUILD_CONST_KEY_MAP', 'BUILD_STRING',
+    'LOAD_CONST','RETURN_VALUE','STORE_SUBSCR', 'STORE_MAP',
+    'LIST_TO_TUPLE', 'LIST_EXTEND', 'SET_UPDATE', 'DICT_UPDATE', 'DICT_MERGE',
     ]
 
 _expr_codes = _const_codes + [

{"golden_diff": "diff --git a/pwnlib/util/safeeval.py b/pwnlib/util/safeeval.py\n--- a/pwnlib/util/safeeval.py\n+++ b/pwnlib/util/safeeval.py\n@@ -3,7 +3,9 @@\n _const_codes = [\n     'POP_TOP','ROT_TWO','ROT_THREE','ROT_FOUR','DUP_TOP',\n     'BUILD_LIST','BUILD_MAP','BUILD_TUPLE','BUILD_SET',\n-    'LOAD_CONST','RETURN_VALUE','STORE_SUBSCR', 'STORE_MAP'\n+    'BUILD_CONST_KEY_MAP', 'BUILD_STRING',\n+    'LOAD_CONST','RETURN_VALUE','STORE_SUBSCR', 'STORE_MAP',\n+    'LIST_TO_TUPLE', 'LIST_EXTEND', 'SET_UPDATE', 'DICT_UPDATE', 'DICT_MERGE',\n     ]\n \n _expr_codes = _const_codes + [\n", "issue": "opcode LIST_EXTEND not allowed\nPython 3.9.0 brings new opcode [`LIST_EXTEND`](https://docs.python.org/3/library/dis.html#opcode-LIST_EXTEND), which leads to an error during `pwn` import:\r\n\r\n```\r\n$ cat ~/.pwn.conf\r\n[context]\r\nterminal = ['alacritty', '-e', 'sh', '-c']\r\n$ ipython\r\nPython 3.9.0 (default, Oct  7 2020, 23:09:01)\r\nType 'copyright', 'credits' or 'license' for more information\r\nIPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.\r\n\r\nIn [1]: import pwn\r\n---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n<ipython-input-1-85301d96339b> in <module>\r\n----> 1 import pwn\r\n\r\n~/src/pwntools/pwn/toplevel.py in <module>\r\n      6 pwnlib.args.initialize()\r\n      7 pwnlib.log.install_default_handler()\r\n----> 8 pwnlib.config.initialize()\r\n      9\r\n     10 log = pwnlib.log.getLogger('pwnlib.exploit')\r\n\r\n~/src/pwntools/pwnlib/config.py in initialize()\r\n     62             continue\r\n     63         settings = dict(c.items(section))\r\n---> 64         registered_configs[section](settings)\r\n\r\n~/src/pwntools/pwnlib/context/__init__.py in update_context_defaults(section)\r\n   1491\r\n   1492         if isinstance(default, six.string_types + six.integer_types + (tuple, list, dict)):\r\n-> 1493             value = safeeval.expr(value)\r\n   1494         else:\r\n   1495             log.warn(\"Unsupported configuration option %r in section %r\" % (key, 'context'))\r\n\r\n~/src/pwntools/pwnlib/util/safeeval.py in expr(expr)\r\n    109     \"\"\"\r\n    110\r\n--> 111     c = test_expr(expr, _expr_codes)\r\n    112     return eval(c)\r\n    113\r\n\r\n~/src/pwntools/pwnlib/util/safeeval.py in test_expr(expr, allowed_codes)\r\n     61     for code in codes:\r\n     62         if code not in allowed_codes:\r\n---> 63             raise ValueError(\"opcode %s not allowed\" % dis.opname[code])\r\n     64     return c\r\n     65\r\n\r\nValueError: opcode LIST_EXTEND not allowed\r\n```\r\n\r\nAdding `'LIST_EXTEND'` to [`_const_codes`](https://github.com/Gallopsled/pwntools/blob/db8df476b2bed695dea14eb726b45237b972811f/pwnlib/util/safeeval.py#L3) or [`_expr_codes`](https://github.com/Gallopsled/pwntools/blob/db8df476b2bed695dea14eb726b45237b972811f/pwnlib/util/safeeval.py#L9) seems to solve the issue, but I'm not familiar with this code.\r\n\r\nAlso, there are more new opcodes: `LIST_TO_TUPLE`, `SET_UPDATE`, etc.\n", "before_files": [{"content": "from __future__ import division\n\n_const_codes = [\n    'POP_TOP','ROT_TWO','ROT_THREE','ROT_FOUR','DUP_TOP',\n    'BUILD_LIST','BUILD_MAP','BUILD_TUPLE','BUILD_SET',\n    'LOAD_CONST','RETURN_VALUE','STORE_SUBSCR', 'STORE_MAP'\n    ]\n\n_expr_codes = _const_codes + [\n    'UNARY_POSITIVE','UNARY_NEGATIVE','UNARY_NOT',\n    'UNARY_INVERT','BINARY_POWER','BINARY_MULTIPLY',\n    'BINARY_DIVIDE','BINARY_FLOOR_DIVIDE','BINARY_TRUE_DIVIDE',\n    'BINARY_MODULO','BINARY_ADD','BINARY_SUBTRACT',\n    'BINARY_LSHIFT','BINARY_RSHIFT','BINARY_AND','BINARY_XOR',\n    'BINARY_OR',\n    ]\n\n_values_codes = _expr_codes + ['LOAD_NAME']\n\nimport six\n\ndef _get_opcodes(codeobj):\n    \"\"\"_get_opcodes(codeobj) -> [opcodes]\n\n    Extract the actual opcodes as a list from a code object\n\n    >>> c = compile(\"[1 + 2, (1,2)]\", \"\", \"eval\")\n    >>> _get_opcodes(c)\n    [100, 100, 103, 83]\n    \"\"\"\n    import dis\n    if hasattr(dis, 'get_instructions'):\n        return [ins.opcode for ins in dis.get_instructions(codeobj)]\n    i = 0\n    opcodes = []\n    s = codeobj.co_code\n    while i < len(s):\n        code = six.indexbytes(s, i)\n        opcodes.append(code)\n        if code >= dis.HAVE_ARGUMENT:\n            i += 3\n        else:\n            i += 1\n    return opcodes\n\ndef test_expr(expr, allowed_codes):\n    \"\"\"test_expr(expr, allowed_codes) -> codeobj\n\n    Test that the expression contains only the listed opcodes.\n    If the expression is valid and contains only allowed codes,\n    return the compiled code object. Otherwise raise a ValueError\n    \"\"\"\n    import dis\n    allowed_codes = [dis.opmap[c] for c in allowed_codes if c in dis.opmap]\n    try:\n        c = compile(expr, \"\", \"eval\")\n    except SyntaxError:\n        raise ValueError(\"%s is not a valid expression\" % expr)\n    codes = _get_opcodes(c)\n    for code in codes:\n        if code not in allowed_codes:\n            raise ValueError(\"opcode %s not allowed\" % dis.opname[code])\n    return c\n\ndef const(expr):\n    \"\"\"const(expression) -> value\n\n    Safe Python constant evaluation\n\n    Evaluates a string that contains an expression describing\n    a Python constant. Strings that are not valid Python expressions\n    or that contain other code besides the constant raise ValueError.\n\n    Examples:\n\n        >>> const(\"10\")\n        10\n        >>> const(\"[1,2, (3,4), {'foo':'bar'}]\")\n        [1, 2, (3, 4), {'foo': 'bar'}]\n        >>> const(\"[1]+[2]\")\n        Traceback (most recent call last):\n        ...\n        ValueError: opcode BINARY_ADD not allowed\n    \"\"\"\n\n    c = test_expr(expr, _const_codes)\n    return eval(c)\n\ndef expr(expr):\n    \"\"\"expr(expression) -> value\n\n    Safe Python expression evaluation\n\n    Evaluates a string that contains an expression that only\n    uses Python constants. This can be used to e.g. evaluate\n    a numerical expression from an untrusted source.\n\n    Examples:\n\n        >>> expr(\"1+2\")\n        3\n        >>> expr(\"[1,2]*2\")\n        [1, 2, 1, 2]\n        >>> expr(\"__import__('sys').modules\")\n        Traceback (most recent call last):\n        ...\n        ValueError: opcode LOAD_NAME not allowed\n    \"\"\"\n\n    c = test_expr(expr, _expr_codes)\n    return eval(c)\n\ndef values(expr, env):\n    \"\"\"values(expression, dict) -> value\n\n    Safe Python expression evaluation\n\n    Evaluates a string that contains an expression that only\n    uses Python constants and values from a supplied dictionary.\n    This can be used to e.g. evaluate e.g. an argument to a syscall.\n\n    Note: This is potentially unsafe if e.g. the __add__ method has side\n          effects.\n\n    Examples:\n\n        >>> values(\"A + 4\", {'A': 6})\n        10\n        >>> class Foo:\n        ...    def __add__(self, other):\n        ...        print(\"Firing the missiles\")\n        >>> values(\"A + 1\", {'A': Foo()})\n        Firing the missiles\n        >>> values(\"A.x\", {'A': Foo()})\n        Traceback (most recent call last):\n        ...\n        ValueError: opcode LOAD_ATTR not allowed\n    \"\"\"\n\n    # The caller might need his dictionary again\n    env = dict(env)\n\n    # We do not want to have built-ins set\n    env['__builtins__'] = {}\n\n    c = test_expr(expr, _values_codes)\n    return eval(c, env)\n", "path": "pwnlib/util/safeeval.py"}], "after_files": [{"content": "from __future__ import division\n\n_const_codes = [\n    'POP_TOP','ROT_TWO','ROT_THREE','ROT_FOUR','DUP_TOP',\n    'BUILD_LIST','BUILD_MAP','BUILD_TUPLE','BUILD_SET',\n    'BUILD_CONST_KEY_MAP', 'BUILD_STRING',\n    'LOAD_CONST','RETURN_VALUE','STORE_SUBSCR', 'STORE_MAP',\n    'LIST_TO_TUPLE', 'LIST_EXTEND', 'SET_UPDATE', 'DICT_UPDATE', 'DICT_MERGE',\n    ]\n\n_expr_codes = _const_codes + [\n    'UNARY_POSITIVE','UNARY_NEGATIVE','UNARY_NOT',\n    'UNARY_INVERT','BINARY_POWER','BINARY_MULTIPLY',\n    'BINARY_DIVIDE','BINARY_FLOOR_DIVIDE','BINARY_TRUE_DIVIDE',\n    'BINARY_MODULO','BINARY_ADD','BINARY_SUBTRACT',\n    'BINARY_LSHIFT','BINARY_RSHIFT','BINARY_AND','BINARY_XOR',\n    'BINARY_OR',\n    ]\n\n_values_codes = _expr_codes + ['LOAD_NAME']\n\nimport six\n\ndef _get_opcodes(codeobj):\n    \"\"\"_get_opcodes(codeobj) -> [opcodes]\n\n    Extract the actual opcodes as a list from a code object\n\n    >>> c = compile(\"[1 + 2, (1,2)]\", \"\", \"eval\")\n    >>> _get_opcodes(c)\n    [100, 100, 103, 83]\n    \"\"\"\n    import dis\n    if hasattr(dis, 'get_instructions'):\n        return [ins.opcode for ins in dis.get_instructions(codeobj)]\n    i = 0\n    opcodes = []\n    s = codeobj.co_code\n    while i < len(s):\n        code = six.indexbytes(s, i)\n        opcodes.append(code)\n        if code >= dis.HAVE_ARGUMENT:\n            i += 3\n        else:\n            i += 1\n    return opcodes\n\ndef test_expr(expr, allowed_codes):\n    \"\"\"test_expr(expr, allowed_codes) -> codeobj\n\n    Test that the expression contains only the listed opcodes.\n    If the expression is valid and contains only allowed codes,\n    return the compiled code object. Otherwise raise a ValueError\n    \"\"\"\n    import dis\n    allowed_codes = [dis.opmap[c] for c in allowed_codes if c in dis.opmap]\n    try:\n        c = compile(expr, \"\", \"eval\")\n    except SyntaxError:\n        raise ValueError(\"%s is not a valid expression\" % expr)\n    codes = _get_opcodes(c)\n    for code in codes:\n        if code not in allowed_codes:\n            raise ValueError(\"opcode %s not allowed\" % dis.opname[code])\n    return c\n\ndef const(expr):\n    \"\"\"const(expression) -> value\n\n    Safe Python constant evaluation\n\n    Evaluates a string that contains an expression describing\n    a Python constant. Strings that are not valid Python expressions\n    or that contain other code besides the constant raise ValueError.\n\n    Examples:\n\n        >>> const(\"10\")\n        10\n        >>> const(\"[1,2, (3,4), {'foo':'bar'}]\")\n        [1, 2, (3, 4), {'foo': 'bar'}]\n        >>> const(\"[1]+[2]\")\n        Traceback (most recent call last):\n        ...\n        ValueError: opcode BINARY_ADD not allowed\n    \"\"\"\n\n    c = test_expr(expr, _const_codes)\n    return eval(c)\n\ndef expr(expr):\n    \"\"\"expr(expression) -> value\n\n    Safe Python expression evaluation\n\n    Evaluates a string that contains an expression that only\n    uses Python constants. This can be used to e.g. evaluate\n    a numerical expression from an untrusted source.\n\n    Examples:\n\n        >>> expr(\"1+2\")\n        3\n        >>> expr(\"[1,2]*2\")\n        [1, 2, 1, 2]\n        >>> expr(\"__import__('sys').modules\")\n        Traceback (most recent call last):\n        ...\n        ValueError: opcode LOAD_NAME not allowed\n    \"\"\"\n\n    c = test_expr(expr, _expr_codes)\n    return eval(c)\n\ndef values(expr, env):\n    \"\"\"values(expression, dict) -> value\n\n    Safe Python expression evaluation\n\n    Evaluates a string that contains an expression that only\n    uses Python constants and values from a supplied dictionary.\n    This can be used to e.g. evaluate e.g. an argument to a syscall.\n\n    Note: This is potentially unsafe if e.g. the __add__ method has side\n          effects.\n\n    Examples:\n\n        >>> values(\"A + 4\", {'A': 6})\n        10\n        >>> class Foo:\n        ...    def __add__(self, other):\n        ...        print(\"Firing the missiles\")\n        >>> values(\"A + 1\", {'A': Foo()})\n        Firing the missiles\n        >>> values(\"A.x\", {'A': Foo()})\n        Traceback (most recent call last):\n        ...\n        ValueError: opcode LOAD_ATTR not allowed\n    \"\"\"\n\n    # The caller might need his dictionary again\n    env = dict(env)\n\n    # We do not want to have built-ins set\n    env['__builtins__'] = {}\n\n    c = test_expr(expr, _values_codes)\n    return eval(c, env)\n", "path": "pwnlib/util/safeeval.py"}]}