From: <ef...@us...> - 2008-09-17 18:30:54
|
Revision: 6105 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6105&view=rev Author: efiring Date: 2008-09-18 01:30:52 +0000 (Thu, 18 Sep 2008) Log Message: ----------- validate num argument to figure() Otherwise, the resulting exception can be obscure and delayed. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/pyplot.py Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2008-09-18 00:49:15 UTC (rev 6104) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008-09-18 01:30:52 UTC (rev 6105) @@ -184,7 +184,7 @@ """ call signature:: - figure(num = None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k') + figure(num=None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k') Create a new figure and return a :class:`matplotlib.figure.Figure` @@ -234,7 +234,10 @@ num = max(allnums) + 1 else: num = 1 + else: + num = int(num) # crude validation of num argument + figManager = _pylab_helpers.Gcf.get_fig_manager(num) if figManager is None: if get_backend().lower() == 'ps': dpi = 72 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |