We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Draw circle does not obey shape argument - v0.93
In previous version worked fine, but I just installed new version 0.93 and draw.circle is not working properly. When I apply the circle for image 1024x1024 with following arguments:
rr,cc=circle(-5.2796287128712879E+02, 1.5003712871287132E+02, 9.8910961199417170E+02, (1024,1024))

I get negative values in rr and cc arrays. Which obviously leads to errors when applied to:
img[rr,cc]=0


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `skimage/draw/draw.py`
Content:
```
1 # coding: utf-8
2 import numpy as np
3 
4 
5 def _coords_inside_image(rr, cc, shape):
6     mask = (rr >= 0) & (rr < shape[0]) & (cc >= 0) & (cc < shape[1])
7     return rr[mask], cc[mask]
8 
9 
10 def ellipse(cy, cx, yradius, xradius, shape=None):
11     """Generate coordinates of pixels within ellipse.
12 
13     Parameters
14     ----------
15     cy, cx : double
16         Centre coordinate of ellipse.
17     yradius, xradius : double
18         Minor and major semi-axes. ``(x/xradius)**2 + (y/yradius)**2 = 1``.
19     shape : tuple, optional
20         Image shape which is used to determine maximum extents of output pixel
21         coordinates. This is useful for ellipses which exceed the image size.
22         By default the full extents of the ellipse are used.
23 
24     Returns
25     -------
26     rr, cc : ndarray of int
27         Pixel coordinates of ellipse.
28         May be used to directly index into an array, e.g.
29         ``img[rr, cc] = 1``.
30 
31     Examples
32     --------
33     >>> from skimage.draw import ellipse
34     >>> img = np.zeros((10, 10), dtype=np.uint8)
35     >>> rr, cc = ellipse(5, 5, 3, 4)
36     >>> img[rr, cc] = 1
37     >>> img
38     array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
39            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
40            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
41            [0, 0, 0, 1, 1, 1, 1, 1, 0, 0],
42            [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
43            [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
44            [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
45            [0, 0, 0, 1, 1, 1, 1, 1, 0, 0],
46            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
47            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
48 
49     """
50 
51     dr = 1 / float(yradius)
52     dc = 1 / float(xradius)
53 
54     r, c = np.ogrid[-1:1:dr, -1:1:dc]
55     rr, cc = np.nonzero(r ** 2 + c ** 2 < 1)
56 
57     rr.flags.writeable = True
58     cc.flags.writeable = True
59     rr += cy - yradius
60     cc += cx - xradius
61 
62     if shape is not None:
63         _coords_inside_image(rr, cc, shape)
64 
65     return rr, cc
66 
67 
68 def circle(cy, cx, radius, shape=None):
69     """Generate coordinates of pixels within circle.
70 
71     Parameters
72     ----------
73     cy, cx : double
74         Centre coordinate of circle.
75     radius: double
76         Radius of circle.
77     shape : tuple, optional
78         Image shape which is used to determine maximum extents of output pixel
79         coordinates. This is useful for circles which exceed the image size.
80         By default the full extents of the circle are used.
81 
82     Returns
83     -------
84     rr, cc : ndarray of int
85         Pixel coordinates of circle.
86         May be used to directly index into an array, e.g.
87         ``img[rr, cc] = 1``.
88     Notes
89     -----
90         This function is a wrapper for skimage.draw.ellipse()
91 
92     Examples
93     --------
94     >>> from skimage.draw import circle
95     >>> img = np.zeros((10, 10), dtype=np.uint8)
96     >>> rr, cc = circle(4, 4, 5)
97     >>> img[rr, cc] = 1
98     >>> img
99     array([[0, 0, 1, 1, 1, 1, 1, 0, 0, 0],
100            [0, 1, 1, 1, 1, 1, 1, 1, 0, 0],
101            [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
102            [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
103            [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
104            [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
105            [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
106            [0, 1, 1, 1, 1, 1, 1, 1, 0, 0],
107            [0, 0, 1, 1, 1, 1, 1, 0, 0, 0],
108            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
109 
110     """
111 
112     return ellipse(cy, cx, radius, radius, shape)
113 
114 
115 def set_color(img, coords, color):
116     """Set pixel color in the image at the given coordinates.
117 
118     Coordinates that exceed the shape of the image will be ignored.
119 
120     Parameters
121     ----------
122     img : (M, N, D) ndarray
123         Image
124     coords : ((P,) ndarray, (P,) ndarray)
125         Coordinates of pixels to be colored.
126     color : (D,) ndarray
127         Color to be assigned to coordinates in the image.
128 
129     Returns
130     -------
131     img : (M, N, D) ndarray
132         The updated image.
133 
134     Examples
135     --------
136     >>> from skimage.draw import line, set_color
137     >>> img = np.zeros((10, 10), dtype=np.uint8)
138     >>> rr, cc = line(1, 1, 20, 20)
139     >>> set_color(img, (rr, cc), 1)
140     >>> img
141     array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
142            [0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
143            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
144            [0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
145            [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
146            [0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
147            [0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
148            [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
149            [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
150            [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]], dtype=uint8)
151 
152     """
153 
154     rr, cc = coords
155     rr, cc = _coords_inside_image(rr, cc, img.shape)
156     img[rr, cc] = color
157
```
--- 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/skimage/draw/draw.py b/skimage/draw/draw.py
--- a/skimage/draw/draw.py
+++ b/skimage/draw/draw.py
@@ -60,7 +60,7 @@
     cc += cx - xradius
 
     if shape is not None:
-        _coords_inside_image(rr, cc, shape)
+        return _coords_inside_image(rr, cc, shape)
 
     return rr, cc

{"golden_diff": "diff --git a/skimage/draw/draw.py b/skimage/draw/draw.py\n--- a/skimage/draw/draw.py\n+++ b/skimage/draw/draw.py\n@@ -60,7 +60,7 @@\n     cc += cx - xradius\n \n     if shape is not None:\n-        _coords_inside_image(rr, cc, shape)\n+        return _coords_inside_image(rr, cc, shape)\n \n     return rr, cc\n", "issue": "Draw circle does not obey shape argument - v0.93\nIn previous version worked fine, but I just installed new version 0.93 and draw.circle is not working properly. When I apply the circle for image 1024x1024 with following arguments:\nrr,cc=circle(-5.2796287128712879E+02, 1.5003712871287132E+02, 9.8910961199417170E+02, (1024,1024))\n\nI get negative values in rr and cc arrays. Which obviously leads to errors when applied to:\nimg[rr,cc]=0\n\n", "before_files": [{"content": "# coding: utf-8\nimport numpy as np\n\n\ndef _coords_inside_image(rr, cc, shape):\n    mask = (rr >= 0) & (rr < shape[0]) & (cc >= 0) & (cc < shape[1])\n    return rr[mask], cc[mask]\n\n\ndef ellipse(cy, cx, yradius, xradius, shape=None):\n    \"\"\"Generate coordinates of pixels within ellipse.\n\n    Parameters\n    ----------\n    cy, cx : double\n        Centre coordinate of ellipse.\n    yradius, xradius : double\n        Minor and major semi-axes. ``(x/xradius)**2 + (y/yradius)**2 = 1``.\n    shape : tuple, optional\n        Image shape which is used to determine maximum extents of output pixel\n        coordinates. This is useful for ellipses which exceed the image size.\n        By default the full extents of the ellipse are used.\n\n    Returns\n    -------\n    rr, cc : ndarray of int\n        Pixel coordinates of ellipse.\n        May be used to directly index into an array, e.g.\n        ``img[rr, cc] = 1``.\n\n    Examples\n    --------\n    >>> from skimage.draw import ellipse\n    >>> img = np.zeros((10, 10), dtype=np.uint8)\n    >>> rr, cc = ellipse(5, 5, 3, 4)\n    >>> img[rr, cc] = 1\n    >>> img\n    array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 1, 1, 1, 1, 1, 0, 0],\n           [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],\n           [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],\n           [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],\n           [0, 0, 0, 1, 1, 1, 1, 1, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)\n\n    \"\"\"\n\n    dr = 1 / float(yradius)\n    dc = 1 / float(xradius)\n\n    r, c = np.ogrid[-1:1:dr, -1:1:dc]\n    rr, cc = np.nonzero(r ** 2 + c ** 2 < 1)\n\n    rr.flags.writeable = True\n    cc.flags.writeable = True\n    rr += cy - yradius\n    cc += cx - xradius\n\n    if shape is not None:\n        _coords_inside_image(rr, cc, shape)\n\n    return rr, cc\n\n\ndef circle(cy, cx, radius, shape=None):\n    \"\"\"Generate coordinates of pixels within circle.\n\n    Parameters\n    ----------\n    cy, cx : double\n        Centre coordinate of circle.\n    radius: double\n        Radius of circle.\n    shape : tuple, optional\n        Image shape which is used to determine maximum extents of output pixel\n        coordinates. This is useful for circles which exceed the image size.\n        By default the full extents of the circle are used.\n\n    Returns\n    -------\n    rr, cc : ndarray of int\n        Pixel coordinates of circle.\n        May be used to directly index into an array, e.g.\n        ``img[rr, cc] = 1``.\n    Notes\n    -----\n        This function is a wrapper for skimage.draw.ellipse()\n\n    Examples\n    --------\n    >>> from skimage.draw import circle\n    >>> img = np.zeros((10, 10), dtype=np.uint8)\n    >>> rr, cc = circle(4, 4, 5)\n    >>> img[rr, cc] = 1\n    >>> img\n    array([[0, 0, 1, 1, 1, 1, 1, 0, 0, 0],\n           [0, 1, 1, 1, 1, 1, 1, 1, 0, 0],\n           [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],\n           [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],\n           [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],\n           [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],\n           [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],\n           [0, 1, 1, 1, 1, 1, 1, 1, 0, 0],\n           [0, 0, 1, 1, 1, 1, 1, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)\n\n    \"\"\"\n\n    return ellipse(cy, cx, radius, radius, shape)\n\n\ndef set_color(img, coords, color):\n    \"\"\"Set pixel color in the image at the given coordinates.\n\n    Coordinates that exceed the shape of the image will be ignored.\n\n    Parameters\n    ----------\n    img : (M, N, D) ndarray\n        Image\n    coords : ((P,) ndarray, (P,) ndarray)\n        Coordinates of pixels to be colored.\n    color : (D,) ndarray\n        Color to be assigned to coordinates in the image.\n\n    Returns\n    -------\n    img : (M, N, D) ndarray\n        The updated image.\n\n    Examples\n    --------\n    >>> from skimage.draw import line, set_color\n    >>> img = np.zeros((10, 10), dtype=np.uint8)\n    >>> rr, cc = line(1, 1, 20, 20)\n    >>> set_color(img, (rr, cc), 1)\n    >>> img\n    array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 1, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 1, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 0, 1, 0, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 1, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]], dtype=uint8)\n\n    \"\"\"\n\n    rr, cc = coords\n    rr, cc = _coords_inside_image(rr, cc, img.shape)\n    img[rr, cc] = color\n", "path": "skimage/draw/draw.py"}], "after_files": [{"content": "# coding: utf-8\nimport numpy as np\n\n\ndef _coords_inside_image(rr, cc, shape):\n    mask = (rr >= 0) & (rr < shape[0]) & (cc >= 0) & (cc < shape[1])\n    return rr[mask], cc[mask]\n\n\ndef ellipse(cy, cx, yradius, xradius, shape=None):\n    \"\"\"Generate coordinates of pixels within ellipse.\n\n    Parameters\n    ----------\n    cy, cx : double\n        Centre coordinate of ellipse.\n    yradius, xradius : double\n        Minor and major semi-axes. ``(x/xradius)**2 + (y/yradius)**2 = 1``.\n    shape : tuple, optional\n        Image shape which is used to determine maximum extents of output pixel\n        coordinates. This is useful for ellipses which exceed the image size.\n        By default the full extents of the ellipse are used.\n\n    Returns\n    -------\n    rr, cc : ndarray of int\n        Pixel coordinates of ellipse.\n        May be used to directly index into an array, e.g.\n        ``img[rr, cc] = 1``.\n\n    Examples\n    --------\n    >>> from skimage.draw import ellipse\n    >>> img = np.zeros((10, 10), dtype=np.uint8)\n    >>> rr, cc = ellipse(5, 5, 3, 4)\n    >>> img[rr, cc] = 1\n    >>> img\n    array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 1, 1, 1, 1, 1, 0, 0],\n           [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],\n           [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],\n           [0, 0, 1, 1, 1, 1, 1, 1, 1, 0],\n           [0, 0, 0, 1, 1, 1, 1, 1, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)\n\n    \"\"\"\n\n    dr = 1 / float(yradius)\n    dc = 1 / float(xradius)\n\n    r, c = np.ogrid[-1:1:dr, -1:1:dc]\n    rr, cc = np.nonzero(r ** 2 + c ** 2 < 1)\n\n    rr.flags.writeable = True\n    cc.flags.writeable = True\n    rr += cy - yradius\n    cc += cx - xradius\n\n    if shape is not None:\n        return _coords_inside_image(rr, cc, shape)\n\n    return rr, cc\n\n\ndef circle(cy, cx, radius, shape=None):\n    \"\"\"Generate coordinates of pixels within circle.\n\n    Parameters\n    ----------\n    cy, cx : double\n        Centre coordinate of circle.\n    radius: double\n        Radius of circle.\n    shape : tuple, optional\n        Image shape which is used to determine maximum extents of output pixel\n        coordinates. This is useful for circles which exceed the image size.\n        By default the full extents of the circle are used.\n\n    Returns\n    -------\n    rr, cc : ndarray of int\n        Pixel coordinates of circle.\n        May be used to directly index into an array, e.g.\n        ``img[rr, cc] = 1``.\n    Notes\n    -----\n        This function is a wrapper for skimage.draw.ellipse()\n\n    Examples\n    --------\n    >>> from skimage.draw import circle\n    >>> img = np.zeros((10, 10), dtype=np.uint8)\n    >>> rr, cc = circle(4, 4, 5)\n    >>> img[rr, cc] = 1\n    >>> img\n    array([[0, 0, 1, 1, 1, 1, 1, 0, 0, 0],\n           [0, 1, 1, 1, 1, 1, 1, 1, 0, 0],\n           [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],\n           [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],\n           [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],\n           [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],\n           [1, 1, 1, 1, 1, 1, 1, 1, 1, 0],\n           [0, 1, 1, 1, 1, 1, 1, 1, 0, 0],\n           [0, 0, 1, 1, 1, 1, 1, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)\n\n    \"\"\"\n\n    return ellipse(cy, cx, radius, radius, shape)\n\n\ndef set_color(img, coords, color):\n    \"\"\"Set pixel color in the image at the given coordinates.\n\n    Coordinates that exceed the shape of the image will be ignored.\n\n    Parameters\n    ----------\n    img : (M, N, D) ndarray\n        Image\n    coords : ((P,) ndarray, (P,) ndarray)\n        Coordinates of pixels to be colored.\n    color : (D,) ndarray\n        Color to be assigned to coordinates in the image.\n\n    Returns\n    -------\n    img : (M, N, D) ndarray\n        The updated image.\n\n    Examples\n    --------\n    >>> from skimage.draw import line, set_color\n    >>> img = np.zeros((10, 10), dtype=np.uint8)\n    >>> rr, cc = line(1, 1, 20, 20)\n    >>> set_color(img, (rr, cc), 1)\n    >>> img\n    array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 1, 0, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 1, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 0, 1, 0, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 1, 0, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],\n           [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]], dtype=uint8)\n\n    \"\"\"\n\n    rr, cc = coords\n    rr, cc = _coords_inside_image(rr, cc, img.shape)\n    img[rr, cc] = color\n", "path": "skimage/draw/draw.py"}]}