Revision: 6911
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6911&view=rev
Author:   ryanmay
Date:     2009-02-13 17:54:52 +0000 (Fri, 13 Feb 2009)

Log Message:
-----------
Backport fix for infinite recursion when finding the appropriate converter for 
a string.  A lot of users seem to be hitting this.

Modified Paths:
--------------
    branches/v0_98_5_maint/lib/matplotlib/units.py

Modified: branches/v0_98_5_maint/lib/matplotlib/units.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/units.py      2009-02-12 21:24:36 UTC 
(rev 6910)
+++ branches/v0_98_5_maint/lib/matplotlib/units.py      2009-02-13 17:54:52 UTC 
(rev 6911)
@@ -44,7 +44,7 @@
 
 """
 import numpy as np
-from matplotlib.cbook import iterable, is_numlike
+from matplotlib.cbook import iterable, is_numlike, is_string_like
 
 class AxisInfo:
     'information to support default axis labeling and tick labeling'
@@ -127,7 +127,10 @@
         if classx is not None:
             converter = self.get(classx)
 
-        if converter is None and iterable(x):
+        # Check explicity for strings here because they would otherwise
+        # lead to an infinite recursion, because a single character will
+        # pass the iterable() check.
+        if converter is None and iterable(x) and not is_string_like(x):
             # if this is anything but an object array, we'll assume
             # there are no custom units
             if isinstance(x, np.ndarray) and x.dtype != np.object:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to