Issue 1:
Bug report

Bug summary

Saving a plot to disk on matplotlib 2.1rc errors out on MacOS using the macosx backend.

Code for reproduction

from matplotlib import pyplot as plt
plt.plot([1, 2], [1, 2])
plt.savefig('test.png')

Actual outcome

SystemError Traceback (most recent call last)
<ipython-input-1-5eab99386a20> in <module>()
1 from matplotlib import pyplot as plt
2 plt.plot([1, 2], [1, 2])
----> 3 plt.savefig('test.png')

/usr/local/lib/python3.5/site-packages/matplotlib/pyplot.py in savefig(*args, **kwargs)
705 def savefig(*args, **kwargs):
706 fig = gcf()
--> 707 res = fig.savefig(*args, **kwargs)
708 fig.canvas.draw_idle() # need this if 'transparent=True' to reset colors
709 return res

/usr/local/lib/python3.5/site-packages/matplotlib/figure.py in savefig(self, fname, **kwargs)
1811 self.set_frameon(frameon)
1812
-> 1813 self.canvas.print_figure(fname, **kwargs)
1814
1815 if frameon:

/usr/local/lib/python3.5/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2256 orientation=orientation,
2257 bbox_inches_restore=_bbox_inches_restore,
-> 2258 **kwargs)
2259 finally:
2260 if bbox_inches and restore_bbox:

/usr/local/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
505
506 def print_png(self, filename_or_obj, *args, **kwargs):
--> 507 FigureCanvasAgg.draw(self)
508 renderer = self.get_renderer()
509 original_dpi = renderer.dpi

/usr/local/lib/python3.5/site-packages/matplotlib/backends/backend_agg.py in draw(self)
427 try:
428 if toolbar:
--> 429 toolbar.set_cursor(cursors.WAIT)
430 self.figure.draw(self.renderer)
431 finally:

/usr/local/lib/python3.5/site-packages/matplotlib/backends/backend_macosx.py in set_cursor(self, cursor)
186
187 def set_cursor(self, cursor):
--> 188 _macosx.set_cursor(cursor)
189
190 def save_figure(self, *args):

SystemError: <built-in function set_cursor> returned NULL without setting an error

Expected outcome

Plot gets saved to disk without error. No error is triggered on matplotlib 2.0.2.

Matplotlib version

Operating System: Mac OS 10.12

Matplotlib Version: 2.12rc, installed using the pre-release Mac wheel on pypi.

Python Version: 3.5.2

Jupyter Version (if applicable):

Other Libraries:

Issue 2:
Bug report

Saving .png files is currently failing on the osx backend. I'm guessing this is due to #6603 (see the error message below)

Code for reproduction

import matplotlib
matplotlib.use('MacOSX')
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
fig.savefig('test.png')

Actual outcome

File "test.py", line 6, in <module>
fig.savefig('test.png')
File "/Users/dstansby/github/matplotlib/lib/matplotlib/figure.py", line 1813, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/Users/dstansby/github/matplotlib/lib/matplotlib/backend_bases.py", line 2258, in print_figure
**kwargs)
File "/Users/dstansby/github/matplotlib/lib/matplotlib/backends/backend_agg.py", line 507, in print_png
FigureCanvasAgg.draw(self)
File "/Users/dstansby/github/matplotlib/lib/matplotlib/backends/backend_agg.py", line 429, in draw
toolbar.set_cursor(cursors.WAIT)
File "/Users/dstansby/github/matplotlib/lib/matplotlib/backends/backend_macosx.py", line 188, in set_cursor
_macosx.set_cursor(cursor)
SystemError: <built-in function set_cursor> returned NULL without setting an error

Expected outcome

Matplotlib version

Operating System: OSX

Matplotlib Version: Current master branch installed using pip

Python Version: 3.6.2