Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Converting datetimes with non-trivial timezones to datetime64 is broken on python 2.6 #7336

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

Closed
njsmith opened this issue Feb 25, 2016 · 8 comments

Comments

@njsmith
Copy link
Member

njsmith commented Feb 25, 2016

As discussed in #7324, #6453 added a code path that references the timedelta.total_seconds() method, which is new in 2.7. We didn't notice this because the code path is only hit when converting Python datetime objects to datetime64, and only for datetime objects that have a .tzinfo attribute which is not None, and it turns out that we don't install pytz on Travis/Appveyor and so never actually ran this test on 2.6.

This is totally uninteresting for master, because master has already dropped 2.6 support (except that we should install pytz on Travis/Appveyor, which is #7335).

Options:

  • Replace this with some 2.6-compatible code. (it looks like we just need td.days * 86400 + td.seconds, though this is a bit annoying to do from C)
  • Declare that 2.6 is officially unsupported in 1.11
  • Mark this as a known 2.6-only bug in the release notes, move on with life

I guess I'm leaning towards the latter.

@njsmith njsmith added this to the 1.11.0 release milestone Feb 25, 2016
@jakirkham
Copy link
Contributor

Even if we go with the latter, the test should be marked as a known failure at least for Python 2.6.

@jakirkham
Copy link
Contributor

Also, @shoyer, figured I would raise this to your attention as the discussion has moved here and I figure you would want a say on this.

@shoyer
Copy link
Member

shoyer commented Feb 25, 2016

This code path has actually been around for years (from some of the original datetime64 work), but it was never tested. What #6453 added was actually deprecation test that happens to exercise this otherwise untested code path.

Given that this code path is now deprecated and in fact never worked on Python 2.6, I think we can safely call it a "bug", skip that test on Python 2.6 and move on. I guess it would be a good idea to fix it in theory, but it seems pretty pointless to me (nobody is currently relying on this) and counter-productive to encourage users to rely on deprecated behavior.

@njsmith
Copy link
Member Author

njsmith commented Feb 25, 2016

@shoyer: Ah-hah, I was wondering why total_seconds didn't show up in the diff for #6453!

Yeah, given that, it sounds like the "resolution" here is just to disable that test on py26 or similar

@jakirkham
Copy link
Contributor

I added this ( #7337 ) to mark that test as a known failure. May need the wording tweaked.

@jakirkham
Copy link
Contributor

Also, sorry for the confusion @shoyer. I only noticed the test was added then. I did not know the full story behind it.

@jakirkham
Copy link
Contributor

Also, maybe we can install pytz during CI to avoid dealing with surprise test failures. :) Added in this PR ( #7338 ).

@charris
Copy link
Member

charris commented Feb 25, 2016

Closed by #7337.

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

No branches or pull requests

4 participants