Skip to content

Fix issue #4496: tslib.tz_convert(vals, tz1, tz2) may raise an IndexErro... #4497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

stenri
Copy link
Contributor

@stenri stenri commented Aug 7, 2013

Bug-fix for Issue #4496 Bug: tslib.tz_convert(vals, tz1, tz2) may raise an IndexError exception.

@cpcloud
Copy link
Member

cpcloud commented Aug 7, 2013

couple of things, please do the following

  • add a test
  • hook up travis CI
  • add documentation to doc/release.rst, preferentially move the docstring in your test to release notes, but not necessary. if you just want to add a blurb that's fine too.

try:
hour = idx.hour
except:
self.assert_(False), 'tslib.tz_convert() "trans[pos + 1] out of bounds" bug found.'
Copy link
Member

Choose a reason for hiding this comment

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

You should rewrite this according to what the hour should be here, don't catch every exception: that could hide another bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Fixed.

Should I create a new Pull request, or just wait while this one is approved?

@stenri
Copy link
Contributor Author

stenri commented Aug 7, 2013

  • hook up travis CI // done;
  • add documentation to doc/release.rst // done (not sure whether such a long bug description is appropriate in release.rst);
  • "You should rewrite this according to what the hour should be here, don't catch every exception: that could hide another bug." // That's reasonable. Thanks! Fixed.

@jreback
Copy link
Contributor

jreback commented Aug 23, 2013

@stenri can you rebase and hook up travis?

@stenri
Copy link
Contributor Author

stenri commented Aug 23, 2013

Surely. I rebased tslib_tz_convert_trans_pos_plus_1__bugfix against upstream/master (and combined all my commits into a one commit).

@@ -197,6 +197,27 @@ See :ref:`Internal Refactoring<whatsnew_0130.refactoring>`
- raising an invalid ``TypeError`` rather than ``ValueError`` when appending
with a different block ordering (:issue:`4096`)
- ``read_hdf`` was not respecting as passed ``mode`` (:issue:`4504`)
- Fixed bug in tslib.tz_convert(vals, tz1, tz2): it could raise IndexError exception while
Copy link
Contributor

Choose a reason for hiding this comment

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

can you just make this a one-liner here? (and put the explanation with the test, though could be a bit shorter)...thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well.. ok. Though Phillip Cloud asked me to do something that looks exact the opposite (initially my detailed explanation was located within the test doc string):

"add documentation to doc/release.rst, preferentially move the docstring in your test to release notes, but not necessary. if you just want to add a blurb that's fine too."

Anyway, I'll try to make my explanation shorter, and put a one-liner in release.rst.

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry for the confusion. The idea is that release notes is a pretty short explanation, a doc-string is user visibile should shouldn't be that crazy. Docs can be full explanation. But, in this case its actually a bug fix reference (that won't be there after), so can put in the test suite.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I see. I removed detailed explanation from release.rst. Now both release.rst and doc string in unit-test reference Issue #4496, where I wrote the detailed bug description. So interested person can look there for details.

@jreback
Copy link
Contributor

jreback commented Aug 23, 2013

@stenri can you squash into 1 commit? then will merge

@stenri
Copy link
Contributor Author

stenri commented Aug 23, 2013

Excellent! Done.

jreback added a commit that referenced this pull request Aug 23, 2013
…1__bugfix

Fix issue #4496: tslib.tz_convert(vals, tz1, tz2) may raise an IndexErro...
@jreback jreback merged commit f41e929 into pandas-dev:master Aug 23, 2013
@jreback
Copy link
Contributor

jreback commented Aug 23, 2013

thanks!

@stenri stenri deleted the tslib_tz_convert_trans_pos_plus_1__bugfix branch August 23, 2013 14:26
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