prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Python 3.9 support
  - CI
  - cupy-release-tools
  
  --- 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 import glob
  4 import os
  5 from setuptools import setup, find_packages
  6 import sys
  7 
  8 import cupy_setup_build
  9 
  10 
  11 for submodule in ('cupy/core/include/cupy/cub/',
  12                   'cupy/core/include/cupy/jitify'):
  13     if len(os.listdir(submodule)) == 0:
  14         msg = '''
  15         The folder %s is a git submodule but is
  16         currently empty. Please use the command
  17 
  18             git submodule update --init
  19 
  20         to populate the folder before building from source.
  21         ''' % submodule
  22         print(msg, file=sys.stderr)
  23         sys.exit(1)
  24 
  25 
  26 requirements = {
  27     'setup': [
  28         'fastrlock>=0.5',
  29     ],
  30     'install': [
  31         'numpy>=1.17',
  32         'fastrlock>=0.5',
  33     ],
  34     'all': [
  35         'scipy>=1.4',
  36         'optuna>=2.0',
  37     ],
  38 
  39     'stylecheck': [
  40         'autopep8==1.4.4',
  41         'flake8==3.7.9',
  42         'pbr==4.0.4',
  43         'pycodestyle==2.5.0',
  44     ],
  45     'test': [
  46         # 4.2 <= pytest < 6.2 is slow collecting tests and times out on CI.
  47         'pytest>=6.2',
  48     ],
  49     'appveyor': [
  50         '-r test',
  51     ],
  52     'jenkins': [
  53         '-r test',
  54         'pytest-timeout',
  55         'pytest-cov',
  56         'coveralls',
  57         'codecov',
  58         'coverage<5',  # Otherwise, Python must be built with sqlite
  59     ],
  60 }
  61 
  62 
  63 def reduce_requirements(key):
  64     # Resolve recursive requirements notation (-r)
  65     reqs = requirements[key]
  66     resolved_reqs = []
  67     for req in reqs:
  68         if req.startswith('-r'):
  69             depend_key = req[2:].lstrip()
  70             reduce_requirements(depend_key)
  71             resolved_reqs += requirements[depend_key]
  72         else:
  73             resolved_reqs.append(req)
  74     requirements[key] = resolved_reqs
  75 
  76 
  77 for k in requirements.keys():
  78     reduce_requirements(k)
  79 
  80 
  81 extras_require = {k: v for k, v in requirements.items() if k != 'install'}
  82 
  83 
  84 setup_requires = requirements['setup']
  85 install_requires = requirements['install']
  86 tests_require = requirements['test']
  87 
  88 # List of files that needs to be in the distribution (sdist/wheel).
  89 # Notes:
  90 # - Files only needed in sdist should be added to `MANIFEST.in`.
  91 # - The following glob (`**`) ignores items starting with `.`.
  92 cupy_package_data = [
  93     'cupy/cuda/cupy_thrust.cu',
  94     'cupy/cuda/cupy_cub.cu',
  95     'cupy/cuda/cupy_cufftXt.cu',  # for cuFFT callback
  96     'cupy/cuda/cupy_cufftXt.h',  # for cuFFT callback
  97     'cupy/cuda/cupy_cufft.h',  # for cuFFT callback
  98     'cupy/cuda/cufft.pxd',  # for cuFFT callback
  99     'cupy/cuda/cufft.pyx',  # for cuFFT callback
  100     'cupy/random/cupy_distributions.cu',
  101     'cupy/random/cupy_distributions.cuh',
  102 ] + [
  103     x for x in glob.glob('cupy/core/include/cupy/**', recursive=True)
  104     if os.path.isfile(x)
  105 ]
  106 
  107 package_data = {
  108     'cupy': [
  109         os.path.relpath(x, 'cupy') for x in cupy_package_data
  110     ],
  111 }
  112 
  113 package_data['cupy'] += cupy_setup_build.prepare_wheel_libs()
  114 
  115 package_name = cupy_setup_build.get_package_name()
  116 long_description = cupy_setup_build.get_long_description()
  117 ext_modules = cupy_setup_build.get_ext_modules()
  118 build_ext = cupy_setup_build.custom_build_ext
  119 sdist = cupy_setup_build.sdist_with_cython
  120 
  121 here = os.path.abspath(os.path.dirname(__file__))
  122 # Get __version__ variable
  123 with open(os.path.join(here, 'cupy', '_version.py')) as f:
  124     exec(f.read())
  125 
  126 CLASSIFIERS = """\
  127 Development Status :: 5 - Production/Stable
  128 Intended Audience :: Science/Research
  129 Intended Audience :: Developers
  130 License :: OSI Approved :: MIT License
  131 Programming Language :: Python
  132 Programming Language :: Python :: 3
  133 Programming Language :: Python :: 3.6
  134 Programming Language :: Python :: 3.7
  135 Programming Language :: Python :: 3.8
  136 Programming Language :: Python :: 3 :: Only
  137 Programming Language :: Cython
  138 Topic :: Software Development
  139 Topic :: Scientific/Engineering
  140 Operating System :: POSIX
  141 Operating System :: Microsoft :: Windows
  142 """
  143 
  144 
  145 setup(
  146     name=package_name,
  147     version=__version__,  # NOQA
  148     description='CuPy: A NumPy-compatible array library accelerated by CUDA',
  149     long_description=long_description,
  150     author='Seiya Tokui',
  151     author_email='tokui@preferred.jp',
  152     url='https://cupy.dev/',
  153     license='MIT License',
  154     project_urls={
  155         "Bug Tracker": "https://github.com/cupy/cupy/issues",
  156         "Documentation": "https://docs.cupy.dev/",
  157         "Source Code": "https://github.com/cupy/cupy",
  158     },
  159     classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
  160     packages=find_packages(exclude=['install', 'tests']),
  161     package_data=package_data,
  162     zip_safe=False,
  163     python_requires='>=3.6.0',
  164     setup_requires=setup_requires,
  165     install_requires=install_requires,
  166     tests_require=tests_require,
  167     extras_require=extras_require,
  168     ext_modules=ext_modules,
  169     cmdclass={'build_ext': build_ext,
  170               'sdist': sdist},
  171 )
  172
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -133,6 +133,7 @@
   Programming Language :: Python :: 3.6
   Programming Language :: Python :: 3.7
   Programming Language :: Python :: 3.8
  +Programming Language :: Python :: 3.9
   Programming Language :: Python :: 3 :: Only
   Programming Language :: Cython
   Topic :: Software Development
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -133,6 +133,7 @@\n Programming Language :: Python :: 3.6\n Programming Language :: Python :: 3.7\n Programming Language :: Python :: 3.8\n+Programming Language :: Python :: 3.9\n Programming Language :: Python :: 3 :: Only\n Programming Language :: Cython\n Topic :: Software Development\n", "issue": "Python 3.9 support\n- CI\r\n- cupy-release-tools\n", "before_files": [{"content": "#!/usr/bin/env python\n\nimport glob\nimport os\nfrom setuptools import setup, find_packages\nimport sys\n\nimport cupy_setup_build\n\n\nfor submodule in ('cupy/core/include/cupy/cub/',\n                  'cupy/core/include/cupy/jitify'):\n    if len(os.listdir(submodule)) == 0:\n        msg = '''\n        The folder %s is a git submodule but is\n        currently empty. Please use the command\n\n            git submodule update --init\n\n        to populate the folder before building from source.\n        ''' % submodule\n        print(msg, file=sys.stderr)\n        sys.exit(1)\n\n\nrequirements = {\n    'setup': [\n        'fastrlock>=0.5',\n    ],\n    'install': [\n        'numpy>=1.17',\n        'fastrlock>=0.5',\n    ],\n    'all': [\n        'scipy>=1.4',\n        'optuna>=2.0',\n    ],\n\n    'stylecheck': [\n        'autopep8==1.4.4',\n        'flake8==3.7.9',\n        'pbr==4.0.4',\n        'pycodestyle==2.5.0',\n    ],\n    'test': [\n        # 4.2 <= pytest < 6.2 is slow collecting tests and times out on CI.\n        'pytest>=6.2',\n    ],\n    'appveyor': [\n        '-r test',\n    ],\n    'jenkins': [\n        '-r test',\n        'pytest-timeout',\n        'pytest-cov',\n        'coveralls',\n        'codecov',\n        'coverage<5',  # Otherwise, Python must be built with sqlite\n    ],\n}\n\n\ndef reduce_requirements(key):\n    # Resolve recursive requirements notation (-r)\n    reqs = requirements[key]\n    resolved_reqs = []\n    for req in reqs:\n        if req.startswith('-r'):\n            depend_key = req[2:].lstrip()\n            reduce_requirements(depend_key)\n            resolved_reqs += requirements[depend_key]\n        else:\n            resolved_reqs.append(req)\n    requirements[key] = resolved_reqs\n\n\nfor k in requirements.keys():\n    reduce_requirements(k)\n\n\nextras_require = {k: v for k, v in requirements.items() if k != 'install'}\n\n\nsetup_requires = requirements['setup']\ninstall_requires = requirements['install']\ntests_require = requirements['test']\n\n# List of files that needs to be in the distribution (sdist/wheel).\n# Notes:\n# - Files only needed in sdist should be added to `MANIFEST.in`.\n# - The following glob (`**`) ignores items starting with `.`.\ncupy_package_data = [\n    'cupy/cuda/cupy_thrust.cu',\n    'cupy/cuda/cupy_cub.cu',\n    'cupy/cuda/cupy_cufftXt.cu',  # for cuFFT callback\n    'cupy/cuda/cupy_cufftXt.h',  # for cuFFT callback\n    'cupy/cuda/cupy_cufft.h',  # for cuFFT callback\n    'cupy/cuda/cufft.pxd',  # for cuFFT callback\n    'cupy/cuda/cufft.pyx',  # for cuFFT callback\n    'cupy/random/cupy_distributions.cu',\n    'cupy/random/cupy_distributions.cuh',\n] + [\n    x for x in glob.glob('cupy/core/include/cupy/**', recursive=True)\n    if os.path.isfile(x)\n]\n\npackage_data = {\n    'cupy': [\n        os.path.relpath(x, 'cupy') for x in cupy_package_data\n    ],\n}\n\npackage_data['cupy'] += cupy_setup_build.prepare_wheel_libs()\n\npackage_name = cupy_setup_build.get_package_name()\nlong_description = cupy_setup_build.get_long_description()\next_modules = cupy_setup_build.get_ext_modules()\nbuild_ext = cupy_setup_build.custom_build_ext\nsdist = cupy_setup_build.sdist_with_cython\n\nhere = os.path.abspath(os.path.dirname(__file__))\n# Get __version__ variable\nwith open(os.path.join(here, 'cupy', '_version.py')) as f:\n    exec(f.read())\n\nCLASSIFIERS = \"\"\"\\\nDevelopment Status :: 5 - Production/Stable\nIntended Audience :: Science/Research\nIntended Audience :: Developers\nLicense :: OSI Approved :: MIT License\nProgramming Language :: Python\nProgramming Language :: Python :: 3\nProgramming Language :: Python :: 3.6\nProgramming Language :: Python :: 3.7\nProgramming Language :: Python :: 3.8\nProgramming Language :: Python :: 3 :: Only\nProgramming Language :: Cython\nTopic :: Software Development\nTopic :: Scientific/Engineering\nOperating System :: POSIX\nOperating System :: Microsoft :: Windows\n\"\"\"\n\n\nsetup(\n    name=package_name,\n    version=__version__,  # NOQA\n    description='CuPy: A NumPy-compatible array library accelerated by CUDA',\n    long_description=long_description,\n    author='Seiya Tokui',\n    author_email='tokui@preferred.jp',\n    url='https://cupy.dev/',\n    license='MIT License',\n    project_urls={\n        \"Bug Tracker\": \"https://github.com/cupy/cupy/issues\",\n        \"Documentation\": \"https://docs.cupy.dev/\",\n        \"Source Code\": \"https://github.com/cupy/cupy\",\n    },\n    classifiers=[_f for _f in CLASSIFIERS.split('\\n') if _f],\n    packages=find_packages(exclude=['install', 'tests']),\n    package_data=package_data,\n    zip_safe=False,\n    python_requires='>=3.6.0',\n    setup_requires=setup_requires,\n    install_requires=install_requires,\n    tests_require=tests_require,\n    extras_require=extras_require,\n    ext_modules=ext_modules,\n    cmdclass={'build_ext': build_ext,\n              'sdist': sdist},\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\nimport glob\nimport os\nfrom setuptools import setup, find_packages\nimport sys\n\nimport cupy_setup_build\n\n\nfor submodule in ('cupy/core/include/cupy/cub/',\n                  'cupy/core/include/cupy/jitify'):\n    if len(os.listdir(submodule)) == 0:\n        msg = '''\n        The folder %s is a git submodule but is\n        currently empty. Please use the command\n\n            git submodule update --init\n\n        to populate the folder before building from source.\n        ''' % submodule\n        print(msg, file=sys.stderr)\n        sys.exit(1)\n\n\nrequirements = {\n    'setup': [\n        'fastrlock>=0.5',\n    ],\n    'install': [\n        'numpy>=1.17',\n        'fastrlock>=0.5',\n    ],\n    'all': [\n        'scipy>=1.4',\n        'optuna>=2.0',\n    ],\n\n    'stylecheck': [\n        'autopep8==1.4.4',\n        'flake8==3.7.9',\n        'pbr==4.0.4',\n        'pycodestyle==2.5.0',\n    ],\n    'test': [\n        # 4.2 <= pytest < 6.2 is slow collecting tests and times out on CI.\n        'pytest>=6.2',\n    ],\n    'appveyor': [\n        '-r test',\n    ],\n    'jenkins': [\n        '-r test',\n        'pytest-timeout',\n        'pytest-cov',\n        'coveralls',\n        'codecov',\n        'coverage<5',  # Otherwise, Python must be built with sqlite\n    ],\n}\n\n\ndef reduce_requirements(key):\n    # Resolve recursive requirements notation (-r)\n    reqs = requirements[key]\n    resolved_reqs = []\n    for req in reqs:\n        if req.startswith('-r'):\n            depend_key = req[2:].lstrip()\n            reduce_requirements(depend_key)\n            resolved_reqs += requirements[depend_key]\n        else:\n            resolved_reqs.append(req)\n    requirements[key] = resolved_reqs\n\n\nfor k in requirements.keys():\n    reduce_requirements(k)\n\n\nextras_require = {k: v for k, v in requirements.items() if k != 'install'}\n\n\nsetup_requires = requirements['setup']\ninstall_requires = requirements['install']\ntests_require = requirements['test']\n\n# List of files that needs to be in the distribution (sdist/wheel).\n# Notes:\n# - Files only needed in sdist should be added to `MANIFEST.in`.\n# - The following glob (`**`) ignores items starting with `.`.\ncupy_package_data = [\n    'cupy/cuda/cupy_thrust.cu',\n    'cupy/cuda/cupy_cub.cu',\n    'cupy/cuda/cupy_cufftXt.cu',  # for cuFFT callback\n    'cupy/cuda/cupy_cufftXt.h',  # for cuFFT callback\n    'cupy/cuda/cupy_cufft.h',  # for cuFFT callback\n    'cupy/cuda/cufft.pxd',  # for cuFFT callback\n    'cupy/cuda/cufft.pyx',  # for cuFFT callback\n    'cupy/random/cupy_distributions.cu',\n    'cupy/random/cupy_distributions.cuh',\n] + [\n    x for x in glob.glob('cupy/core/include/cupy/**', recursive=True)\n    if os.path.isfile(x)\n]\n\npackage_data = {\n    'cupy': [\n        os.path.relpath(x, 'cupy') for x in cupy_package_data\n    ],\n}\n\npackage_data['cupy'] += cupy_setup_build.prepare_wheel_libs()\n\npackage_name = cupy_setup_build.get_package_name()\nlong_description = cupy_setup_build.get_long_description()\next_modules = cupy_setup_build.get_ext_modules()\nbuild_ext = cupy_setup_build.custom_build_ext\nsdist = cupy_setup_build.sdist_with_cython\n\nhere = os.path.abspath(os.path.dirname(__file__))\n# Get __version__ variable\nwith open(os.path.join(here, 'cupy', '_version.py')) as f:\n    exec(f.read())\n\nCLASSIFIERS = \"\"\"\\\nDevelopment Status :: 5 - Production/Stable\nIntended Audience :: Science/Research\nIntended Audience :: Developers\nLicense :: OSI Approved :: MIT License\nProgramming Language :: Python\nProgramming Language :: Python :: 3\nProgramming Language :: Python :: 3.6\nProgramming Language :: Python :: 3.7\nProgramming Language :: Python :: 3.8\nProgramming Language :: Python :: 3.9\nProgramming Language :: Python :: 3 :: Only\nProgramming Language :: Cython\nTopic :: Software Development\nTopic :: Scientific/Engineering\nOperating System :: POSIX\nOperating System :: Microsoft :: Windows\n\"\"\"\n\n\nsetup(\n    name=package_name,\n    version=__version__,  # NOQA\n    description='CuPy: A NumPy-compatible array library accelerated by CUDA',\n    long_description=long_description,\n    author='Seiya Tokui',\n    author_email='tokui@preferred.jp',\n    url='https://cupy.dev/',\n    license='MIT License',\n    project_urls={\n        \"Bug Tracker\": \"https://github.com/cupy/cupy/issues\",\n        \"Documentation\": \"https://docs.cupy.dev/\",\n        \"Source Code\": \"https://github.com/cupy/cupy\",\n    },\n    classifiers=[_f for _f in CLASSIFIERS.split('\\n') if _f],\n    packages=find_packages(exclude=['install', 'tests']),\n    package_data=package_data,\n    zip_safe=False,\n    python_requires='>=3.6.0',\n    setup_requires=setup_requires,\n    install_requires=install_requires,\n    tests_require=tests_require,\n    extras_require=extras_require,\n    ext_modules=ext_modules,\n    cmdclass={'build_ext': build_ext,\n              'sdist': sdist},\n)\n", "path": "setup.py"}]}