We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Polygon setEdges does not update the ShapeStim vertices
If I make a polygon object:

``` python
poly = visual.Polygon(win, edges=3, lineWidth=3, radius=3)
poly.draw()
win.flip()
```

and then want to change the shape on the fly in code, I would have though I would do:

``` python
poly.setEdges(5)
poly.draw()
win.flip()
```

This doesn't actually change the shape that gets shown though, but the following code does:

``` python
poly.setEdges(5)
poly.setVertices(poly.vertices)
poly.draw()
win.flip()
```

I think this is because `poly.setEdges` calls `poly._calcVertices` which sets the `poly.vertices` attribute, but `poly.setEdges` doesn't pass the new array to the `poly.setVertices` method, which I gather is inherited from `ShapeStim`.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `psychopy/visual/polygon.py`
Content:
```
1 
2 #!/usr/bin/env python2
3 
4 '''Creates a regular polygon (triangles, pentagrams, ...)
5 as a special case of a :class:`~psychopy.visual.ShapeStim`'''
6 
7 # Part of the PsychoPy library
8 # Copyright (C) 2015 Jonathan Peirce
9 # Distributed under the terms of the GNU General Public License (GPL).
10 
11 import psychopy  # so we can get the __path__
12 
13 from psychopy.visual.shape import ShapeStim
14 from psychopy.tools.attributetools import attributeSetter, setAttribute
15 
16 import numpy
17 
18 
19 class Polygon(ShapeStim):
20     """Creates a regular polygon (triangles, pentagrams, ...) as a special case of a :class:`~psychopy.visual.ShapeStim`
21 
22     (New in version 1.72.00)
23     """
24     def __init__(self, win, edges=3, radius=.5, **kwargs):
25         """
26         Polygon accepts all input parameters that :class:`~psychopy.visual.ShapeStim` accepts, except for vertices and closeShape.
27         """
28         #what local vars are defined (these are the init params) for use by __repr__
29         self._initParams = dir()
30         self._initParams.remove('self')
31         #kwargs isn't a parameter, but a list of params
32         self._initParams.remove('kwargs')
33         self._initParams.extend(kwargs)
34         self.autoLog = False #but will be changed if needed at end of init
35         self.__dict__['edges'] = edges
36         self.radius = numpy.asarray(radius)
37         self._calcVertices()
38         kwargs['closeShape'] = True # Make sure nobody messes around here
39         kwargs['vertices'] = self.vertices
40         super(Polygon, self).__init__(win, **kwargs)
41 
42     def _calcVertices(self):
43         d = numpy.pi*2/ self.edges
44         self.vertices = numpy.asarray([
45             numpy.asarray(
46                 (numpy.sin(e*d), numpy.cos(e*d))
47             ) * self.radius
48             for e in xrange(int(round(self.edges)))
49         ])
50     
51     @attributeSetter
52     def edges(self, edges):
53         """Int or float. Number of edges of the polygon. Floats are rounded to int.
54         :ref:`Operations <attrib-operations>` supported."""
55         self.__dict__['edges'] = edges
56         self._calcVertices()
57     def setEdges(self, edges, operation='', log=None):
58         """Usually you can use 'stim.attribute = value' syntax instead,
59         but use this method if you need to suppress the log message"""
60         setAttribute(self, 'edges', edges, log, operation)
61 
62     @attributeSetter
63     def radius(self, radius):
64         """float, int, tuple, list or 2x1 array
65         Radius of the Polygon (distance from the center to the corners).
66         May be a -2tuple or list to stretch the polygon asymmetrically.
67 
68         :ref:`Operations <attrib-operations>` supported.
69         
70         Usually there's a setAttribute(value, log=False) method for each attribute. Use this if you want to disable logging."""
71         self.__dict__['radius'] = numpy.array(radius)
72         self._calcVertices()
73         self.setVertices(self.vertices, log=False)
74     def setRadius(self, radius, operation='', log=None):
75         """Usually you can use 'stim.attribute = value' syntax instead,
76         but use this method if you need to suppress the log message"""
77         setAttribute(self, 'radius', radius, log, operation)
```
--- 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/psychopy/visual/polygon.py b/psychopy/visual/polygon.py
--- a/psychopy/visual/polygon.py
+++ b/psychopy/visual/polygon.py
@@ -47,13 +47,14 @@
             ) * self.radius
             for e in xrange(int(round(self.edges)))
         ])
-    
+
     @attributeSetter
     def edges(self, edges):
         """Int or float. Number of edges of the polygon. Floats are rounded to int.
         :ref:`Operations <attrib-operations>` supported."""
         self.__dict__['edges'] = edges
         self._calcVertices()
+        self.setVertices(self.vertices, log=False)
     def setEdges(self, edges, operation='', log=None):
         """Usually you can use 'stim.attribute = value' syntax instead,
         but use this method if you need to suppress the log message"""
@@ -66,7 +67,7 @@
         May be a -2tuple or list to stretch the polygon asymmetrically.
 
         :ref:`Operations <attrib-operations>` supported.
-        
+
         Usually there's a setAttribute(value, log=False) method for each attribute. Use this if you want to disable logging."""
         self.__dict__['radius'] = numpy.array(radius)
         self._calcVertices()
@@ -74,4 +75,4 @@
     def setRadius(self, radius, operation='', log=None):
         """Usually you can use 'stim.attribute = value' syntax instead,
         but use this method if you need to suppress the log message"""
-        setAttribute(self, 'radius', radius, log, operation)
\ No newline at end of file
+        setAttribute(self, 'radius', radius, log, operation)

{"golden_diff": "diff --git a/psychopy/visual/polygon.py b/psychopy/visual/polygon.py\n--- a/psychopy/visual/polygon.py\n+++ b/psychopy/visual/polygon.py\n@@ -47,13 +47,14 @@\n             ) * self.radius\n             for e in xrange(int(round(self.edges)))\n         ])\n-    \n+\n     @attributeSetter\n     def edges(self, edges):\n         \"\"\"Int or float. Number of edges of the polygon. Floats are rounded to int.\n         :ref:`Operations <attrib-operations>` supported.\"\"\"\n         self.__dict__['edges'] = edges\n         self._calcVertices()\n+        self.setVertices(self.vertices, log=False)\n     def setEdges(self, edges, operation='', log=None):\n         \"\"\"Usually you can use 'stim.attribute = value' syntax instead,\n         but use this method if you need to suppress the log message\"\"\"\n@@ -66,7 +67,7 @@\n         May be a -2tuple or list to stretch the polygon asymmetrically.\n \n         :ref:`Operations <attrib-operations>` supported.\n-        \n+\n         Usually there's a setAttribute(value, log=False) method for each attribute. Use this if you want to disable logging.\"\"\"\n         self.__dict__['radius'] = numpy.array(radius)\n         self._calcVertices()\n@@ -74,4 +75,4 @@\n     def setRadius(self, radius, operation='', log=None):\n         \"\"\"Usually you can use 'stim.attribute = value' syntax instead,\n         but use this method if you need to suppress the log message\"\"\"\n-        setAttribute(self, 'radius', radius, log, operation)\n\\ No newline at end of file\n+        setAttribute(self, 'radius', radius, log, operation)\n", "issue": "Polygon setEdges does not update the ShapeStim vertices\nIf I make a polygon object:\n\n``` python\npoly = visual.Polygon(win, edges=3, lineWidth=3, radius=3)\npoly.draw()\nwin.flip()\n```\n\nand then want to change the shape on the fly in code, I would have though I would do:\n\n``` python\npoly.setEdges(5)\npoly.draw()\nwin.flip()\n```\n\nThis doesn't actually change the shape that gets shown though, but the following code does:\n\n``` python\npoly.setEdges(5)\npoly.setVertices(poly.vertices)\npoly.draw()\nwin.flip()\n```\n\nI think this is because `poly.setEdges` calls `poly._calcVertices` which sets the `poly.vertices` attribute, but `poly.setEdges` doesn't pass the new array to the `poly.setVertices` method, which I gather is inherited from `ShapeStim`.\n\n", "before_files": [{"content": "\n#!/usr/bin/env python2\n\n'''Creates a regular polygon (triangles, pentagrams, ...)\nas a special case of a :class:`~psychopy.visual.ShapeStim`'''\n\n# Part of the PsychoPy library\n# Copyright (C) 2015 Jonathan Peirce\n# Distributed under the terms of the GNU General Public License (GPL).\n\nimport psychopy  # so we can get the __path__\n\nfrom psychopy.visual.shape import ShapeStim\nfrom psychopy.tools.attributetools import attributeSetter, setAttribute\n\nimport numpy\n\n\nclass Polygon(ShapeStim):\n    \"\"\"Creates a regular polygon (triangles, pentagrams, ...) as a special case of a :class:`~psychopy.visual.ShapeStim`\n\n    (New in version 1.72.00)\n    \"\"\"\n    def __init__(self, win, edges=3, radius=.5, **kwargs):\n        \"\"\"\n        Polygon accepts all input parameters that :class:`~psychopy.visual.ShapeStim` accepts, except for vertices and closeShape.\n        \"\"\"\n        #what local vars are defined (these are the init params) for use by __repr__\n        self._initParams = dir()\n        self._initParams.remove('self')\n        #kwargs isn't a parameter, but a list of params\n        self._initParams.remove('kwargs')\n        self._initParams.extend(kwargs)\n        self.autoLog = False #but will be changed if needed at end of init\n        self.__dict__['edges'] = edges\n        self.radius = numpy.asarray(radius)\n        self._calcVertices()\n        kwargs['closeShape'] = True # Make sure nobody messes around here\n        kwargs['vertices'] = self.vertices\n        super(Polygon, self).__init__(win, **kwargs)\n\n    def _calcVertices(self):\n        d = numpy.pi*2/ self.edges\n        self.vertices = numpy.asarray([\n            numpy.asarray(\n                (numpy.sin(e*d), numpy.cos(e*d))\n            ) * self.radius\n            for e in xrange(int(round(self.edges)))\n        ])\n    \n    @attributeSetter\n    def edges(self, edges):\n        \"\"\"Int or float. Number of edges of the polygon. Floats are rounded to int.\n        :ref:`Operations <attrib-operations>` supported.\"\"\"\n        self.__dict__['edges'] = edges\n        self._calcVertices()\n    def setEdges(self, edges, operation='', log=None):\n        \"\"\"Usually you can use 'stim.attribute = value' syntax instead,\n        but use this method if you need to suppress the log message\"\"\"\n        setAttribute(self, 'edges', edges, log, operation)\n\n    @attributeSetter\n    def radius(self, radius):\n        \"\"\"float, int, tuple, list or 2x1 array\n        Radius of the Polygon (distance from the center to the corners).\n        May be a -2tuple or list to stretch the polygon asymmetrically.\n\n        :ref:`Operations <attrib-operations>` supported.\n        \n        Usually there's a setAttribute(value, log=False) method for each attribute. Use this if you want to disable logging.\"\"\"\n        self.__dict__['radius'] = numpy.array(radius)\n        self._calcVertices()\n        self.setVertices(self.vertices, log=False)\n    def setRadius(self, radius, operation='', log=None):\n        \"\"\"Usually you can use 'stim.attribute = value' syntax instead,\n        but use this method if you need to suppress the log message\"\"\"\n        setAttribute(self, 'radius', radius, log, operation)", "path": "psychopy/visual/polygon.py"}], "after_files": [{"content": "\n#!/usr/bin/env python2\n\n'''Creates a regular polygon (triangles, pentagrams, ...)\nas a special case of a :class:`~psychopy.visual.ShapeStim`'''\n\n# Part of the PsychoPy library\n# Copyright (C) 2015 Jonathan Peirce\n# Distributed under the terms of the GNU General Public License (GPL).\n\nimport psychopy  # so we can get the __path__\n\nfrom psychopy.visual.shape import ShapeStim\nfrom psychopy.tools.attributetools import attributeSetter, setAttribute\n\nimport numpy\n\n\nclass Polygon(ShapeStim):\n    \"\"\"Creates a regular polygon (triangles, pentagrams, ...) as a special case of a :class:`~psychopy.visual.ShapeStim`\n\n    (New in version 1.72.00)\n    \"\"\"\n    def __init__(self, win, edges=3, radius=.5, **kwargs):\n        \"\"\"\n        Polygon accepts all input parameters that :class:`~psychopy.visual.ShapeStim` accepts, except for vertices and closeShape.\n        \"\"\"\n        #what local vars are defined (these are the init params) for use by __repr__\n        self._initParams = dir()\n        self._initParams.remove('self')\n        #kwargs isn't a parameter, but a list of params\n        self._initParams.remove('kwargs')\n        self._initParams.extend(kwargs)\n        self.autoLog = False #but will be changed if needed at end of init\n        self.__dict__['edges'] = edges\n        self.radius = numpy.asarray(radius)\n        self._calcVertices()\n        kwargs['closeShape'] = True # Make sure nobody messes around here\n        kwargs['vertices'] = self.vertices\n        super(Polygon, self).__init__(win, **kwargs)\n\n    def _calcVertices(self):\n        d = numpy.pi*2/ self.edges\n        self.vertices = numpy.asarray([\n            numpy.asarray(\n                (numpy.sin(e*d), numpy.cos(e*d))\n            ) * self.radius\n            for e in xrange(int(round(self.edges)))\n        ])\n\n    @attributeSetter\n    def edges(self, edges):\n        \"\"\"Int or float. Number of edges of the polygon. Floats are rounded to int.\n        :ref:`Operations <attrib-operations>` supported.\"\"\"\n        self.__dict__['edges'] = edges\n        self._calcVertices()\n        self.setVertices(self.vertices, log=False)\n    def setEdges(self, edges, operation='', log=None):\n        \"\"\"Usually you can use 'stim.attribute = value' syntax instead,\n        but use this method if you need to suppress the log message\"\"\"\n        setAttribute(self, 'edges', edges, log, operation)\n\n    @attributeSetter\n    def radius(self, radius):\n        \"\"\"float, int, tuple, list or 2x1 array\n        Radius of the Polygon (distance from the center to the corners).\n        May be a -2tuple or list to stretch the polygon asymmetrically.\n\n        :ref:`Operations <attrib-operations>` supported.\n\n        Usually there's a setAttribute(value, log=False) method for each attribute. Use this if you want to disable logging.\"\"\"\n        self.__dict__['radius'] = numpy.array(radius)\n        self._calcVertices()\n        self.setVertices(self.vertices, log=False)\n    def setRadius(self, radius, operation='', log=None):\n        \"\"\"Usually you can use 'stim.attribute = value' syntax instead,\n        but use this method if you need to suppress the log message\"\"\"\n        setAttribute(self, 'radius', radius, log, operation)\n", "path": "psychopy/visual/polygon.py"}]}