prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Building Numpy package fails with TypeError: __init__() takes from 3 to 4 positional arguments but 13 were given
  I'm trying in build Numpy on Ubuntu Server Xenial (Armbian 5.14). I have installed `libexpat1-dev`, `libpython3-dev`, `libpython3.5-dev`, `python3-dev`, `python3.5-dev`, `build-essential`, `gcc`, `gfortran`, `gfortran-5`, `libgfortran-5-dev`, `libgfortran3`, `libblas-common`, `libblas-dev`, `libblas3`, `libopenblas-base`, `libopenblas-dev`, `cython`, `libpng-dev`. Cloned git repo to a dir and ran `python3 setup.py build`. Here's the log:
  
  `$ python3 setup.py build`
  
  `Running from numpy source directory.`
  `Cythonizing sources`
  `numpy/random/mtrand/mtrand.pyx has not changed`
  `Traceback (most recent call last):`
  `File "setup.py", line 390, in <module>`
  `setup_package()`
  `File "setup.py", line 382, in setup_package`
  `setup(**metadata)`
  `File "/home/odroid/downloads/numpy/numpy/distutils/core.py", line 135, in setup
      config = configuration()`
  `File "setup.py", line 165, in configuration`
  `config.add_subpackage('numpy')`
  `File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 1001, in add_subpackage`
  `caller_level = 2)`
  `File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 970, in get_subpackage`
  `caller_level = caller_level + 1)`
  `File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 907, in _get_configuration_from_setup_py`
  `config = setup_module.configuration(*args)`
  `File "numpy/setup.py", line 10, in configuration`
  `config.add_subpackage('core')`
  `File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 1001, in add_subpackage`
  `caller_level = 2)`
  `File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 970, in get_subpackage`
  `caller_level = caller_level + 1)`
  `File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 907, in _get_configuration_from_setup_py`
  `config = setup_module.configuration(*args)`
  `File "numpy/core/setup.py", line 638, in configuration
      generate_numpy_api]`
  `File "/home/odroid/downloads/numpy/numpy/distutils/misc_util.py", line 1483, in add_extension`
  `ext = Extension(**ext_args)`
  `File "/home/odroid/downloads/numpy/numpy/distutils/extension.py", line 52, in __init__
      export_symbols)`
  `TypeError: __init__() takes from 3 to 4 positional arguments but 13 were given`
  
  How can it be fixed?
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `numpy/distutils/extension.py`
  Content:
  ```
  1 """distutils.extension
  2 
  3 Provides the Extension class, used to describe C/C++ extension
  4 modules in setup scripts.
  5 
  6 Overridden to support f2py.
  7 
  8 """
  9 from __future__ import division, absolute_import, print_function
  10 
  11 import sys
  12 import re
  13 from distutils.extension import Extension as old_Extension
  14 
  15 if sys.version_info[0] >= 3:
  16     basestring = str
  17 
  18 
  19 cxx_ext_re = re.compile(r'.*[.](cpp|cxx|cc)\Z', re.I).match
  20 fortran_pyf_ext_re = re.compile(r'.*[.](f90|f95|f77|for|ftn|f|pyf)\Z', re.I).match
  21 
  22 class Extension(old_Extension):
  23     def __init__ (self, name, sources,
  24                   include_dirs=None,
  25                   define_macros=None,
  26                   undef_macros=None,
  27                   library_dirs=None,
  28                   libraries=None,
  29                   runtime_library_dirs=None,
  30                   extra_objects=None,
  31                   extra_compile_args=None,
  32                   extra_link_args=None,
  33                   export_symbols=None,
  34                   swig_opts=None,
  35                   depends=None,
  36                   language=None,
  37                   f2py_options=None,
  38                   module_dirs=None,
  39                   extra_f77_compile_args=None,
  40                   extra_f90_compile_args=None,
  41                  ):
  42         old_Extension.__init__(self, name, [],
  43                                include_dirs,
  44                                define_macros,
  45                                undef_macros,
  46                                library_dirs,
  47                                libraries,
  48                                runtime_library_dirs,
  49                                extra_objects,
  50                                extra_compile_args,
  51                                extra_link_args,
  52                                export_symbols)
  53         # Avoid assert statements checking that sources contains strings:
  54         self.sources = sources
  55 
  56         # Python 2.4 distutils new features
  57         self.swig_opts = swig_opts or []
  58         # swig_opts is assumed to be a list. Here we handle the case where it
  59         # is specified as a string instead.
  60         if isinstance(self.swig_opts, basestring):
  61             import warnings
  62             msg = "swig_opts is specified as a string instead of a list"
  63             warnings.warn(msg, SyntaxWarning)
  64             self.swig_opts = self.swig_opts.split()
  65 
  66         # Python 2.3 distutils new features
  67         self.depends = depends or []
  68         self.language = language
  69 
  70         # numpy_distutils features
  71         self.f2py_options = f2py_options or []
  72         self.module_dirs = module_dirs or []
  73         self.extra_f77_compile_args = extra_f77_compile_args or []
  74         self.extra_f90_compile_args = extra_f90_compile_args or []
  75 
  76         return
  77 
  78     def has_cxx_sources(self):
  79         for source in self.sources:
  80             if cxx_ext_re(str(source)):
  81                 return True
  82         return False
  83 
  84     def has_f2py_sources(self):
  85         for source in self.sources:
  86             if fortran_pyf_ext_re(source):
  87                 return True
  88         return False
  89 
  90 # class Extension
  91
  ```
  --- 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/numpy/distutils/extension.py b/numpy/distutils/extension.py
  --- a/numpy/distutils/extension.py
  +++ b/numpy/distutils/extension.py
  @@ -20,36 +20,39 @@
   fortran_pyf_ext_re = re.compile(r'.*[.](f90|f95|f77|for|ftn|f|pyf)\Z', re.I).match
   
   class Extension(old_Extension):
  -    def __init__ (self, name, sources,
  -                  include_dirs=None,
  -                  define_macros=None,
  -                  undef_macros=None,
  -                  library_dirs=None,
  -                  libraries=None,
  -                  runtime_library_dirs=None,
  -                  extra_objects=None,
  -                  extra_compile_args=None,
  -                  extra_link_args=None,
  -                  export_symbols=None,
  -                  swig_opts=None,
  -                  depends=None,
  -                  language=None,
  -                  f2py_options=None,
  -                  module_dirs=None,
  -                  extra_f77_compile_args=None,
  -                  extra_f90_compile_args=None,
  -                 ):
  -        old_Extension.__init__(self, name, [],
  -                               include_dirs,
  -                               define_macros,
  -                               undef_macros,
  -                               library_dirs,
  -                               libraries,
  -                               runtime_library_dirs,
  -                               extra_objects,
  -                               extra_compile_args,
  -                               extra_link_args,
  -                               export_symbols)
  +    def __init__ (
  +            self, name, sources,
  +            include_dirs=None,
  +            define_macros=None,
  +            undef_macros=None,
  +            library_dirs=None,
  +            libraries=None,
  +            runtime_library_dirs=None,
  +            extra_objects=None,
  +            extra_compile_args=None,
  +            extra_link_args=None,
  +            export_symbols=None,
  +            swig_opts=None,
  +            depends=None,
  +            language=None,
  +            f2py_options=None,
  +            module_dirs=None,
  +            extra_f77_compile_args=None,
  +            extra_f90_compile_args=None,):
  +
  +        old_Extension.__init__(
  +                self, name, [],
  +                include_dirs=include_dirs,
  +                define_macros=define_macros,
  +                undef_macros=undef_macros,
  +                library_dirs=library_dirs,
  +                libraries=libraries,
  +                runtime_library_dirs=runtime_library_dirs,
  +                extra_objects=extra_objects,
  +                extra_compile_args=extra_compile_args,
  +                extra_link_args=extra_link_args,
  +                export_symbols=export_symbols)
  +
           # Avoid assert statements checking that sources contains strings:
           self.sources = sources
  
verification_info: {"golden_diff": "diff --git a/numpy/distutils/extension.py b/numpy/distutils/extension.py\n--- a/numpy/distutils/extension.py\n+++ b/numpy/distutils/extension.py\n@@ -20,36 +20,39 @@\n fortran_pyf_ext_re = re.compile(r'.*[.](f90|f95|f77|for|ftn|f|pyf)\\Z', re.I).match\n \n class Extension(old_Extension):\n-    def __init__ (self, name, sources,\n-                  include_dirs=None,\n-                  define_macros=None,\n-                  undef_macros=None,\n-                  library_dirs=None,\n-                  libraries=None,\n-                  runtime_library_dirs=None,\n-                  extra_objects=None,\n-                  extra_compile_args=None,\n-                  extra_link_args=None,\n-                  export_symbols=None,\n-                  swig_opts=None,\n-                  depends=None,\n-                  language=None,\n-                  f2py_options=None,\n-                  module_dirs=None,\n-                  extra_f77_compile_args=None,\n-                  extra_f90_compile_args=None,\n-                 ):\n-        old_Extension.__init__(self, name, [],\n-                               include_dirs,\n-                               define_macros,\n-                               undef_macros,\n-                               library_dirs,\n-                               libraries,\n-                               runtime_library_dirs,\n-                               extra_objects,\n-                               extra_compile_args,\n-                               extra_link_args,\n-                               export_symbols)\n+    def __init__ (\n+            self, name, sources,\n+            include_dirs=None,\n+            define_macros=None,\n+            undef_macros=None,\n+            library_dirs=None,\n+            libraries=None,\n+            runtime_library_dirs=None,\n+            extra_objects=None,\n+            extra_compile_args=None,\n+            extra_link_args=None,\n+            export_symbols=None,\n+            swig_opts=None,\n+            depends=None,\n+            language=None,\n+            f2py_options=None,\n+            module_dirs=None,\n+            extra_f77_compile_args=None,\n+            extra_f90_compile_args=None,):\n+\n+        old_Extension.__init__(\n+                self, name, [],\n+                include_dirs=include_dirs,\n+                define_macros=define_macros,\n+                undef_macros=undef_macros,\n+                library_dirs=library_dirs,\n+                libraries=libraries,\n+                runtime_library_dirs=runtime_library_dirs,\n+                extra_objects=extra_objects,\n+                extra_compile_args=extra_compile_args,\n+                extra_link_args=extra_link_args,\n+                export_symbols=export_symbols)\n+\n         # Avoid assert statements checking that sources contains strings:\n         self.sources = sources\n", "issue": "Building Numpy package fails with TypeError: __init__() takes from 3 to 4 positional arguments but 13 were given\nI'm trying in build Numpy on Ubuntu Server Xenial (Armbian 5.14). I have installed `libexpat1-dev`, `libpython3-dev`, `libpython3.5-dev`, `python3-dev`, `python3.5-dev`, `build-essential`, `gcc`, `gfortran`, `gfortran-5`, `libgfortran-5-dev`, `libgfortran3`, `libblas-common`, `libblas-dev`, `libblas3`, `libopenblas-base`, `libopenblas-dev`, `cython`, `libpng-dev`. Cloned git repo to a dir and ran `python3 setup.py build`. Here's the log:\n\n`$ python3 setup.py build`\n\n`Running from numpy source directory.`\n`Cythonizing sources`\n`numpy/random/mtrand/mtrand.pyx has not changed`\n`Traceback (most recent call last):`\n`File \"setup.py\", line 390, in <module>`\n`setup_package()`\n`File \"setup.py\", line 382, in setup_package`\n`setup(**metadata)`\n`File \"/home/odroid/downloads/numpy/numpy/distutils/core.py\", line 135, in setup\n    config = configuration()`\n`File \"setup.py\", line 165, in configuration`\n`config.add_subpackage('numpy')`\n`File \"/home/odroid/downloads/numpy/numpy/distutils/misc_util.py\", line 1001, in add_subpackage`\n`caller_level = 2)`\n`File \"/home/odroid/downloads/numpy/numpy/distutils/misc_util.py\", line 970, in get_subpackage`\n`caller_level = caller_level + 1)`\n`File \"/home/odroid/downloads/numpy/numpy/distutils/misc_util.py\", line 907, in _get_configuration_from_setup_py`\n`config = setup_module.configuration(*args)`\n`File \"numpy/setup.py\", line 10, in configuration`\n`config.add_subpackage('core')`\n`File \"/home/odroid/downloads/numpy/numpy/distutils/misc_util.py\", line 1001, in add_subpackage`\n`caller_level = 2)`\n`File \"/home/odroid/downloads/numpy/numpy/distutils/misc_util.py\", line 970, in get_subpackage`\n`caller_level = caller_level + 1)`\n`File \"/home/odroid/downloads/numpy/numpy/distutils/misc_util.py\", line 907, in _get_configuration_from_setup_py`\n`config = setup_module.configuration(*args)`\n`File \"numpy/core/setup.py\", line 638, in configuration\n    generate_numpy_api]`\n`File \"/home/odroid/downloads/numpy/numpy/distutils/misc_util.py\", line 1483, in add_extension`\n`ext = Extension(**ext_args)`\n`File \"/home/odroid/downloads/numpy/numpy/distutils/extension.py\", line 52, in __init__\n    export_symbols)`\n`TypeError: __init__() takes from 3 to 4 positional arguments but 13 were given`\n\nHow can it be fixed?\n\n", "before_files": [{"content": "\"\"\"distutils.extension\n\nProvides the Extension class, used to describe C/C++ extension\nmodules in setup scripts.\n\nOverridden to support f2py.\n\n\"\"\"\nfrom __future__ import division, absolute_import, print_function\n\nimport sys\nimport re\nfrom distutils.extension import Extension as old_Extension\n\nif sys.version_info[0] >= 3:\n    basestring = str\n\n\ncxx_ext_re = re.compile(r'.*[.](cpp|cxx|cc)\\Z', re.I).match\nfortran_pyf_ext_re = re.compile(r'.*[.](f90|f95|f77|for|ftn|f|pyf)\\Z', re.I).match\n\nclass Extension(old_Extension):\n    def __init__ (self, name, sources,\n                  include_dirs=None,\n                  define_macros=None,\n                  undef_macros=None,\n                  library_dirs=None,\n                  libraries=None,\n                  runtime_library_dirs=None,\n                  extra_objects=None,\n                  extra_compile_args=None,\n                  extra_link_args=None,\n                  export_symbols=None,\n                  swig_opts=None,\n                  depends=None,\n                  language=None,\n                  f2py_options=None,\n                  module_dirs=None,\n                  extra_f77_compile_args=None,\n                  extra_f90_compile_args=None,\n                 ):\n        old_Extension.__init__(self, name, [],\n                               include_dirs,\n                               define_macros,\n                               undef_macros,\n                               library_dirs,\n                               libraries,\n                               runtime_library_dirs,\n                               extra_objects,\n                               extra_compile_args,\n                               extra_link_args,\n                               export_symbols)\n        # Avoid assert statements checking that sources contains strings:\n        self.sources = sources\n\n        # Python 2.4 distutils new features\n        self.swig_opts = swig_opts or []\n        # swig_opts is assumed to be a list. Here we handle the case where it\n        # is specified as a string instead.\n        if isinstance(self.swig_opts, basestring):\n            import warnings\n            msg = \"swig_opts is specified as a string instead of a list\"\n            warnings.warn(msg, SyntaxWarning)\n            self.swig_opts = self.swig_opts.split()\n\n        # Python 2.3 distutils new features\n        self.depends = depends or []\n        self.language = language\n\n        # numpy_distutils features\n        self.f2py_options = f2py_options or []\n        self.module_dirs = module_dirs or []\n        self.extra_f77_compile_args = extra_f77_compile_args or []\n        self.extra_f90_compile_args = extra_f90_compile_args or []\n\n        return\n\n    def has_cxx_sources(self):\n        for source in self.sources:\n            if cxx_ext_re(str(source)):\n                return True\n        return False\n\n    def has_f2py_sources(self):\n        for source in self.sources:\n            if fortran_pyf_ext_re(source):\n                return True\n        return False\n\n# class Extension\n", "path": "numpy/distutils/extension.py"}], "after_files": [{"content": "\"\"\"distutils.extension\n\nProvides the Extension class, used to describe C/C++ extension\nmodules in setup scripts.\n\nOverridden to support f2py.\n\n\"\"\"\nfrom __future__ import division, absolute_import, print_function\n\nimport sys\nimport re\nfrom distutils.extension import Extension as old_Extension\n\nif sys.version_info[0] >= 3:\n    basestring = str\n\n\ncxx_ext_re = re.compile(r'.*[.](cpp|cxx|cc)\\Z', re.I).match\nfortran_pyf_ext_re = re.compile(r'.*[.](f90|f95|f77|for|ftn|f|pyf)\\Z', re.I).match\n\nclass Extension(old_Extension):\n    def __init__ (\n            self, name, sources,\n            include_dirs=None,\n            define_macros=None,\n            undef_macros=None,\n            library_dirs=None,\n            libraries=None,\n            runtime_library_dirs=None,\n            extra_objects=None,\n            extra_compile_args=None,\n            extra_link_args=None,\n            export_symbols=None,\n            swig_opts=None,\n            depends=None,\n            language=None,\n            f2py_options=None,\n            module_dirs=None,\n            extra_f77_compile_args=None,\n            extra_f90_compile_args=None,):\n\n        old_Extension.__init__(\n                self, name, [],\n                include_dirs=include_dirs,\n                define_macros=define_macros,\n                undef_macros=undef_macros,\n                library_dirs=library_dirs,\n                libraries=libraries,\n                runtime_library_dirs=runtime_library_dirs,\n                extra_objects=extra_objects,\n                extra_compile_args=extra_compile_args,\n                extra_link_args=extra_link_args,\n                export_symbols=export_symbols)\n\n        # Avoid assert statements checking that sources contains strings:\n        self.sources = sources\n\n        # Python 2.4 distutils new features\n        self.swig_opts = swig_opts or []\n        # swig_opts is assumed to be a list. Here we handle the case where it\n        # is specified as a string instead.\n        if isinstance(self.swig_opts, basestring):\n            import warnings\n            msg = \"swig_opts is specified as a string instead of a list\"\n            warnings.warn(msg, SyntaxWarning)\n            self.swig_opts = self.swig_opts.split()\n\n        # Python 2.3 distutils new features\n        self.depends = depends or []\n        self.language = language\n\n        # numpy_distutils features\n        self.f2py_options = f2py_options or []\n        self.module_dirs = module_dirs or []\n        self.extra_f77_compile_args = extra_f77_compile_args or []\n        self.extra_f90_compile_args = extra_f90_compile_args or []\n\n        return\n\n    def has_cxx_sources(self):\n        for source in self.sources:\n            if cxx_ext_re(str(source)):\n                return True\n        return False\n\n    def has_f2py_sources(self):\n        for source in self.sources:\n            if fortran_pyf_ext_re(source):\n                return True\n        return False\n\n# class Extension\n", "path": "numpy/distutils/extension.py"}]}