Skip to content

Unreached/Unreachable(?) paths in tslib #17379

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
jbrockmendel opened this issue Aug 30, 2017 · 3 comments · Fixed by #17402
Closed

Unreached/Unreachable(?) paths in tslib #17379

jbrockmendel opened this issue Aug 30, 2017 · 3 comments · Fixed by #17402
Labels
Clean Internals Related to non-user accessible pandas implementation
Milestone

Comments

@jbrockmendel
Copy link
Member

in tslib._Timedelta.__richcmp__ there is a path that is not reached in tests that I think may not be reachable, seeking second opinions. If there are corner cases where this can be reached, they should be added to the tests.

        if isinstance(other, _Timedelta):
            if isinstance(other, _NaT):
                return _cmp_nat_dt(other, self, _reverse_ops[op])
@gfyoung gfyoung added the Testing pandas testing functions or related to the test suite label Aug 30, 2017
@gfyoung
Copy link
Member

gfyoung commented Aug 30, 2017

This looks reachable, given that _NaT subclasses _Timedelta. If you can write a test that hits this branch of logic, go for it! It seems feasible.

@jbrockmendel
Copy link
Member Author

Are you sure _NaT subclasses _Timedelta? If so, can you help me understand how?

cdef class _NaT(_Timestamp):

@gfyoung gfyoung added Clean Internals Related to non-user accessible pandas implementation and removed Testing pandas testing functions or related to the test suite labels Aug 30, 2017
@gfyoung
Copy link
Member

gfyoung commented Aug 30, 2017

Oops, I misread it as _Timestamp 😄 . My bad, yeah, I think you're probably right then, as I don't think datetime.datetime and datetime.timedelta inherit from one another (trace back the class inheritances for both _Timedelta and _NaT).

Double check and then try removing the check to see what happens.

@jbrockmendel jbrockmendel mentioned this issue Aug 31, 2017
4 tasks
@jreback jreback added this to the 0.21.0 milestone Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Internals Related to non-user accessible pandas implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants