Skip to content

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Dec 1, 2015

No description provided.

@mdboom mdboom added this to the Critical bugfix release (1.5.1) milestone Dec 1, 2015
self._process_unit_info(xdata=xranges[0],
ydata=yrange[0],
if len(xranges):
xdata = xranges[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably safer to do xdata = next(iter(xrange)) in a try...except block. pandas Series slice on index rather than position

try:
    xdata = next(iter(xranges))
except (StopIteration, TypeError):
    xdata = None

@efiring
Copy link
Member

efiring commented Dec 3, 2015

I dimly recall seeing this sort of pre-processing prior to _process_unit_info elsewhere; does it need to be factored out? E.g., could it be added to _process_unit_info itself, perhaps activated with a kwarg? Is there also a Pandas conversion stage that we are stuck having to use now, so that we don't end up sprinkling things like six.next(iter(xxx)) all over the place?

@mdboom
Copy link
Member Author

mdboom commented Dec 22, 2015

This is now ready to merge.

self._process_unit_info(xdata=xranges[0],
ydata=yrange[0],
if len(xranges):
xdata = six.next(iter(xranges))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just use next here https://docs.python.org/2/library/functions.html#next I think six provides it to support back to 2.4 or something like that.

efiring added a commit that referenced this pull request Dec 28, 2015
Fix #5572: Allow passing empty range to broken_barh
@efiring efiring merged commit e7c51dc into matplotlib:master Dec 28, 2015
efiring added a commit that referenced this pull request Dec 28, 2015
Fix #5572: Allow passing empty range to broken_barh
@tacaswell
Copy link
Member

backported as 8228dbd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants