-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Catch SystemError in py3 Period.__richcmp__ #18205
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -693,7 +693,12 @@ cdef class _Period(object): | |
|
||
def __richcmp__(self, other, op): | ||
if is_period_object(other): | ||
if other.freq != self.freq: | ||
try: | ||
if other.freq != self.freq: | ||
msg = _DIFFERENT_FREQ.format(self.freqstr, other.freqstr) | ||
raise IncompatibleFrequency(msg) | ||
except SystemError: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think SystemError exists in py2? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least in 2.7.14 it does. I don't know about earlier off the top. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's there in 2.7.12 and 2.7.9 |
||
# See GH#17112 in python3 | ||
msg = _DIFFERENT_FREQ.format(self.freqstr, other.freqstr) | ||
raise IncompatibleFrequency(msg) | ||
return PyObject_RichCompareBool(self.ordinal, other.ordinal, op) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does
other.freq != self.freq
ever raise?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your guess is as good as mine. Googling turned up some similar errors in Django, a suggestion that the GIL is involved. Hopefully we'll get to the root of the problem eventually. For now I'll be happy to just raise the right error.
Ref #17112, or to reproduce in py3: