We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
contrib/pg8000 is old and causes weird postgres errors
Please update the contrib/pg8000 driver to the current version.
Otherwise errors like Broken Pipe, Operationalerror,.. occur,
- at least for postgres 9.6,
- especially for long running task (ie. scheduler, where they are not properly handled (scheduler workers will restart and earlier run rmains as RUNNING).

related links:
https://github.com/mfenniak/pg8000/issues/73
https://groups.google.com/forum/#!topic/web2py/HAeJevtGtdU

..in copy into issues: web2py/web2py, web2py/pydal


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 
3 from setuptools import setup
4 from gluon.fileutils import tar, untar, read_file, write_file
5 import tarfile
6 import sys
7 
8 
9 def tar(file, filelist, expression='^.+$'):
10     """
11     tars dir/files into file, only tars file that match expression
12     """
13 
14     tar = tarfile.TarFile(file, 'w')
15     try:
16         for element in filelist:
17             try:
18                 for file in listdir(element, expression, add_dirs=True):
19                     tar.add(os.path.join(element, file), file, False)
20             except:
21                 tar.add(element)
22     finally:
23         tar.close()
24 
25 
26 def start():
27     if 'sdist' in sys.argv:
28         tar('gluon/env.tar', ['applications', 'VERSION',
29                               'extras/icons/splashlogo.gif'])
30 
31     setup(name='web2py',
32           version=read_file("VERSION").split()[1],
33           description="""full-stack framework for rapid development and prototyping
34         of secure database-driven web-based applications, written and
35         programmable in Python.""",
36           long_description="""
37         Everything in one package with no dependencies. Development, deployment,
38         debugging, testing, database administration and maintenance of applications can
39         be done via the provided web interface. web2py has no configuration files,
40         requires no installation, can run off a USB drive. web2py uses Python for the
41         Model, the Views and the Controllers, has a built-in ticketing system to manage
42         errors, an internationalization engine, works with SQLite, PostgreSQL, MySQL,
43         MSSQL, FireBird, Oracle, IBM DB2, Informix, Ingres, sybase and Google App Engine via a
44         Database Abstraction Layer. web2py includes libraries to handle
45         HTML/XML, RSS, ATOM, CSV, RTF, JSON, AJAX, XMLRPC, WIKI markup. Production
46         ready, capable of upload/download streaming of very large files, and always
47         backward compatible.
48         """,
49           author='Massimo Di Pierro',
50           author_email='mdipierro@cs.depaul.edu',
51           license='http://web2py.com/examples/default/license',
52           classifiers=["Development Status :: 5 - Production/Stable"],
53           url='http://web2py.com',
54           platforms='Windows, Linux, Mac, Unix,Windows Mobile',
55           packages=['gluon',
56                     'gluon/contrib',
57                     'gluon/contrib/gateways',
58                     'gluon/contrib/login_methods',
59                     'gluon/contrib/markdown',
60                     'gluon/contrib/markmin',
61                     'gluon/contrib/memcache',
62                     'gluon/contrib/fpdf',
63                     'gluon/contrib/pymysql',
64                     'gluon/contrib/pyrtf',
65                     'gluon/contrib/pysimplesoap',
66                     'gluon/contrib/pg8000',
67                     'gluon/contrib/plural_rules',
68                     'gluon/contrib/minify',
69                     'gluon/contrib/pyaes',
70                     'gluon/contrib/pyuca',
71                     'gluon/tests',
72                     ],
73           package_data={'gluon': ['env.tar']},
74 #          scripts=['w2p_apps', 'w2p_run', 'w2p_clone'],
75           )
76 
77 if __name__ == '__main__':
78     #print "web2py does not require installation and"
79     #print "you should just start it with:"
80     #print
81     #print "$ python web2py.py"
82     #print
83     #print "are you sure you want to install it anyway (y/n)?"
84     #s = raw_input('>')
85     #if s.lower()[:1]=='y':
86     start()
87
```
--- 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/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -63,7 +63,6 @@
                     'gluon/contrib/pymysql',
                     'gluon/contrib/pyrtf',
                     'gluon/contrib/pysimplesoap',
-                    'gluon/contrib/pg8000',
                     'gluon/contrib/plural_rules',
                     'gluon/contrib/minify',
                     'gluon/contrib/pyaes',

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -63,7 +63,6 @@\n                     'gluon/contrib/pymysql',\n                     'gluon/contrib/pyrtf',\n                     'gluon/contrib/pysimplesoap',\n-                    'gluon/contrib/pg8000',\n                     'gluon/contrib/plural_rules',\n                     'gluon/contrib/minify',\n                     'gluon/contrib/pyaes',\n", "issue": "contrib/pg8000 is old and causes weird postgres errors\nPlease update the contrib/pg8000 driver to the current version.\r\nOtherwise errors like Broken Pipe, Operationalerror,.. occur,\r\n- at least for postgres 9.6,\r\n- especially for long running task (ie. scheduler, where they are not properly handled (scheduler workers will restart and earlier run rmains as RUNNING).\r\n\r\nrelated links:\r\nhttps://github.com/mfenniak/pg8000/issues/73\r\nhttps://groups.google.com/forum/#!topic/web2py/HAeJevtGtdU\r\n\r\n..in copy into issues: web2py/web2py, web2py/pydal\r\n\n", "before_files": [{"content": "#!/usr/bin/env python\n\nfrom setuptools import setup\nfrom gluon.fileutils import tar, untar, read_file, write_file\nimport tarfile\nimport sys\n\n\ndef tar(file, filelist, expression='^.+$'):\n    \"\"\"\n    tars dir/files into file, only tars file that match expression\n    \"\"\"\n\n    tar = tarfile.TarFile(file, 'w')\n    try:\n        for element in filelist:\n            try:\n                for file in listdir(element, expression, add_dirs=True):\n                    tar.add(os.path.join(element, file), file, False)\n            except:\n                tar.add(element)\n    finally:\n        tar.close()\n\n\ndef start():\n    if 'sdist' in sys.argv:\n        tar('gluon/env.tar', ['applications', 'VERSION',\n                              'extras/icons/splashlogo.gif'])\n\n    setup(name='web2py',\n          version=read_file(\"VERSION\").split()[1],\n          description=\"\"\"full-stack framework for rapid development and prototyping\n        of secure database-driven web-based applications, written and\n        programmable in Python.\"\"\",\n          long_description=\"\"\"\n        Everything in one package with no dependencies. Development, deployment,\n        debugging, testing, database administration and maintenance of applications can\n        be done via the provided web interface. web2py has no configuration files,\n        requires no installation, can run off a USB drive. web2py uses Python for the\n        Model, the Views and the Controllers, has a built-in ticketing system to manage\n        errors, an internationalization engine, works with SQLite, PostgreSQL, MySQL,\n        MSSQL, FireBird, Oracle, IBM DB2, Informix, Ingres, sybase and Google App Engine via a\n        Database Abstraction Layer. web2py includes libraries to handle\n        HTML/XML, RSS, ATOM, CSV, RTF, JSON, AJAX, XMLRPC, WIKI markup. Production\n        ready, capable of upload/download streaming of very large files, and always\n        backward compatible.\n        \"\"\",\n          author='Massimo Di Pierro',\n          author_email='mdipierro@cs.depaul.edu',\n          license='http://web2py.com/examples/default/license',\n          classifiers=[\"Development Status :: 5 - Production/Stable\"],\n          url='http://web2py.com',\n          platforms='Windows, Linux, Mac, Unix,Windows Mobile',\n          packages=['gluon',\n                    'gluon/contrib',\n                    'gluon/contrib/gateways',\n                    'gluon/contrib/login_methods',\n                    'gluon/contrib/markdown',\n                    'gluon/contrib/markmin',\n                    'gluon/contrib/memcache',\n                    'gluon/contrib/fpdf',\n                    'gluon/contrib/pymysql',\n                    'gluon/contrib/pyrtf',\n                    'gluon/contrib/pysimplesoap',\n                    'gluon/contrib/pg8000',\n                    'gluon/contrib/plural_rules',\n                    'gluon/contrib/minify',\n                    'gluon/contrib/pyaes',\n                    'gluon/contrib/pyuca',\n                    'gluon/tests',\n                    ],\n          package_data={'gluon': ['env.tar']},\n#          scripts=['w2p_apps', 'w2p_run', 'w2p_clone'],\n          )\n\nif __name__ == '__main__':\n    #print \"web2py does not require installation and\"\n    #print \"you should just start it with:\"\n    #print\n    #print \"$ python web2py.py\"\n    #print\n    #print \"are you sure you want to install it anyway (y/n)?\"\n    #s = raw_input('>')\n    #if s.lower()[:1]=='y':\n    start()\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\nfrom setuptools import setup\nfrom gluon.fileutils import tar, untar, read_file, write_file\nimport tarfile\nimport sys\n\n\ndef tar(file, filelist, expression='^.+$'):\n    \"\"\"\n    tars dir/files into file, only tars file that match expression\n    \"\"\"\n\n    tar = tarfile.TarFile(file, 'w')\n    try:\n        for element in filelist:\n            try:\n                for file in listdir(element, expression, add_dirs=True):\n                    tar.add(os.path.join(element, file), file, False)\n            except:\n                tar.add(element)\n    finally:\n        tar.close()\n\n\ndef start():\n    if 'sdist' in sys.argv:\n        tar('gluon/env.tar', ['applications', 'VERSION',\n                              'extras/icons/splashlogo.gif'])\n\n    setup(name='web2py',\n          version=read_file(\"VERSION\").split()[1],\n          description=\"\"\"full-stack framework for rapid development and prototyping\n        of secure database-driven web-based applications, written and\n        programmable in Python.\"\"\",\n          long_description=\"\"\"\n        Everything in one package with no dependencies. Development, deployment,\n        debugging, testing, database administration and maintenance of applications can\n        be done via the provided web interface. web2py has no configuration files,\n        requires no installation, can run off a USB drive. web2py uses Python for the\n        Model, the Views and the Controllers, has a built-in ticketing system to manage\n        errors, an internationalization engine, works with SQLite, PostgreSQL, MySQL,\n        MSSQL, FireBird, Oracle, IBM DB2, Informix, Ingres, sybase and Google App Engine via a\n        Database Abstraction Layer. web2py includes libraries to handle\n        HTML/XML, RSS, ATOM, CSV, RTF, JSON, AJAX, XMLRPC, WIKI markup. Production\n        ready, capable of upload/download streaming of very large files, and always\n        backward compatible.\n        \"\"\",\n          author='Massimo Di Pierro',\n          author_email='mdipierro@cs.depaul.edu',\n          license='http://web2py.com/examples/default/license',\n          classifiers=[\"Development Status :: 5 - Production/Stable\"],\n          url='http://web2py.com',\n          platforms='Windows, Linux, Mac, Unix,Windows Mobile',\n          packages=['gluon',\n                    'gluon/contrib',\n                    'gluon/contrib/gateways',\n                    'gluon/contrib/login_methods',\n                    'gluon/contrib/markdown',\n                    'gluon/contrib/markmin',\n                    'gluon/contrib/memcache',\n                    'gluon/contrib/fpdf',\n                    'gluon/contrib/pymysql',\n                    'gluon/contrib/pyrtf',\n                    'gluon/contrib/pysimplesoap',\n                    'gluon/contrib/plural_rules',\n                    'gluon/contrib/minify',\n                    'gluon/contrib/pyaes',\n                    'gluon/contrib/pyuca',\n                    'gluon/tests',\n                    ],\n          package_data={'gluon': ['env.tar']},\n#          scripts=['w2p_apps', 'w2p_run', 'w2p_clone'],\n          )\n\nif __name__ == '__main__':\n    #print \"web2py does not require installation and\"\n    #print \"you should just start it with:\"\n    #print\n    #print \"$ python web2py.py\"\n    #print\n    #print \"are you sure you want to install it anyway (y/n)?\"\n    #s = raw_input('>')\n    #if s.lower()[:1]=='y':\n    start()\n", "path": "setup.py"}]}