prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Setuptools doesn't play nice with Numpy
  See: https://github.com/numpy/numpy/blob/master/numpy/distutils/extension.py#L42-L52
  
  That functionality was broken by:
  https://github.com/pypa/setuptools/blob/master/setuptools/extension.py#L39-L41
  
  In this pr: https://github.com/pypa/setuptools/pull/718
  
  Here's the the pdb session where I debugged this:
  
  ```
  (Pdb) old_Extension.__module__
  'setuptools.extension'
  ```
  
  
  </issue>
  <code>
  [start of setuptools/extension.py]
  1 import sys
  2 import re
  3 import functools
  4 import distutils.core
  5 import distutils.errors
  6 import distutils.extension
  7 
  8 from setuptools.extern.six.moves import map
  9 
  10 from .dist import _get_unpatched
  11 from . import msvc
  12 
  13 _Extension = _get_unpatched(distutils.core.Extension)
  14 
  15 msvc.patch_for_specialized_compiler()
  16 
  17 
  18 def _have_cython():
  19     """
  20     Return True if Cython can be imported.
  21     """
  22     cython_impl = 'Cython.Distutils.build_ext'
  23     try:
  24         # from (cython_impl) import build_ext
  25         __import__(cython_impl, fromlist=['build_ext']).build_ext
  26         return True
  27     except Exception:
  28         pass
  29     return False
  30 
  31 
  32 # for compatibility
  33 have_pyrex = _have_cython
  34 
  35 
  36 class Extension(_Extension):
  37     """Extension that uses '.c' files in place of '.pyx' files"""
  38 
  39     def __init__(self, name, sources, py_limited_api=False, **kw):
  40         self.py_limited_api = py_limited_api
  41         _Extension.__init__(self, name, sources, **kw)
  42 
  43     def _convert_pyx_sources_to_lang(self):
  44         """
  45         Replace sources with .pyx extensions to sources with the target
  46         language extension. This mechanism allows language authors to supply
  47         pre-converted sources but to prefer the .pyx sources.
  48         """
  49         if _have_cython():
  50             # the build has Cython, so allow it to compile the .pyx files
  51             return
  52         lang = self.language or ''
  53         target_ext = '.cpp' if lang.lower() == 'c++' else '.c'
  54         sub = functools.partial(re.sub, '.pyx$', target_ext)
  55         self.sources = list(map(sub, self.sources))
  56 
  57 
  58 class Library(Extension):
  59     """Just like a regular Extension, but built as a library instead"""
  60 
  61 
  62 distutils.core.Extension = Extension
  63 distutils.extension.Extension = Extension
  64 if 'distutils.command.build_ext' in sys.modules:
  65     sys.modules['distutils.command.build_ext'].Extension = Extension
  66
  [end of setuptools/extension.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/setuptools/extension.py b/setuptools/extension.py
  --- a/setuptools/extension.py
  +++ b/setuptools/extension.py
  @@ -36,9 +36,11 @@
   class Extension(_Extension):
       """Extension that uses '.c' files in place of '.pyx' files"""
   
  -    def __init__(self, name, sources, py_limited_api=False, **kw):
  -        self.py_limited_api = py_limited_api
  -        _Extension.__init__(self, name, sources, **kw)
  +    def __init__(self, name, sources, *args, **kw):
  +        # The *args is needed for compatibility as calls may use positional
  +        # arguments. py_limited_api may be set only via keyword.
  +        self.py_limited_api = kw.pop("py_limited_api", False)
  +        _Extension.__init__(self, name, sources, *args, **kw)
   
       def _convert_pyx_sources_to_lang(self):
           """
  
verification_info: {"golden_diff": "diff --git a/setuptools/extension.py b/setuptools/extension.py\n--- a/setuptools/extension.py\n+++ b/setuptools/extension.py\n@@ -36,9 +36,11 @@\n class Extension(_Extension):\n     \"\"\"Extension that uses '.c' files in place of '.pyx' files\"\"\"\n \n-    def __init__(self, name, sources, py_limited_api=False, **kw):\n-        self.py_limited_api = py_limited_api\n-        _Extension.__init__(self, name, sources, **kw)\n+    def __init__(self, name, sources, *args, **kw):\n+        # The *args is needed for compatibility as calls may use positional\n+        # arguments. py_limited_api may be set only via keyword.\n+        self.py_limited_api = kw.pop(\"py_limited_api\", False)\n+        _Extension.__init__(self, name, sources, *args, **kw)\n \n     def _convert_pyx_sources_to_lang(self):\n         \"\"\"\n", "issue": "Setuptools doesn't play nice with Numpy\nSee: https://github.com/numpy/numpy/blob/master/numpy/distutils/extension.py#L42-L52\n\nThat functionality was broken by:\nhttps://github.com/pypa/setuptools/blob/master/setuptools/extension.py#L39-L41\n\nIn this pr: https://github.com/pypa/setuptools/pull/718\n\nHere's the the pdb session where I debugged this:\n\n```\n(Pdb) old_Extension.__module__\n'setuptools.extension'\n```\n\n", "before_files": [{"content": "import sys\nimport re\nimport functools\nimport distutils.core\nimport distutils.errors\nimport distutils.extension\n\nfrom setuptools.extern.six.moves import map\n\nfrom .dist import _get_unpatched\nfrom . import msvc\n\n_Extension = _get_unpatched(distutils.core.Extension)\n\nmsvc.patch_for_specialized_compiler()\n\n\ndef _have_cython():\n    \"\"\"\n    Return True if Cython can be imported.\n    \"\"\"\n    cython_impl = 'Cython.Distutils.build_ext'\n    try:\n        # from (cython_impl) import build_ext\n        __import__(cython_impl, fromlist=['build_ext']).build_ext\n        return True\n    except Exception:\n        pass\n    return False\n\n\n# for compatibility\nhave_pyrex = _have_cython\n\n\nclass Extension(_Extension):\n    \"\"\"Extension that uses '.c' files in place of '.pyx' files\"\"\"\n\n    def __init__(self, name, sources, py_limited_api=False, **kw):\n        self.py_limited_api = py_limited_api\n        _Extension.__init__(self, name, sources, **kw)\n\n    def _convert_pyx_sources_to_lang(self):\n        \"\"\"\n        Replace sources with .pyx extensions to sources with the target\n        language extension. This mechanism allows language authors to supply\n        pre-converted sources but to prefer the .pyx sources.\n        \"\"\"\n        if _have_cython():\n            # the build has Cython, so allow it to compile the .pyx files\n            return\n        lang = self.language or ''\n        target_ext = '.cpp' if lang.lower() == 'c++' else '.c'\n        sub = functools.partial(re.sub, '.pyx$', target_ext)\n        self.sources = list(map(sub, self.sources))\n\n\nclass Library(Extension):\n    \"\"\"Just like a regular Extension, but built as a library instead\"\"\"\n\n\ndistutils.core.Extension = Extension\ndistutils.extension.Extension = Extension\nif 'distutils.command.build_ext' in sys.modules:\n    sys.modules['distutils.command.build_ext'].Extension = Extension\n", "path": "setuptools/extension.py"}]}