-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Segfault in comparison between datetime.timezone.utc and pytz.utc #82096
Comments
The following crashes with Python 3.8b3
When run with
|
I am adding 3.8 regression since the code works with 3.7 though it involves pytz. |
Seems this is due to bpo-37685 (dde944f) on bisecting datetime related changes. Adding Serhiy. I guess this could be marked as release blocker. Here is a simplified reproducer on extracting pytz.utc source [0] which is an object of simple subclass of datetime.tzinfo : import sys
import datetime
print(sys.version)
class UTC(datetime.tzinfo):
pass
print(datetime.timezone.utc == UTC())
datetime.timezone.utc == datetime.tzinfo() # This also segfaults without a subclass and should be False # Segfaults ➜ cpython git:(dde944f) git checkout dde944f && make -s -j4 > /dev/null # Commit before works fine ➜ cpython git:(dde944f) git checkout dde944f~1 && make -s -j4 > /dev/null |
Thanks for debugging this Karthikeyan and for the quick fix Pablo! |
This is due to an incorrect type check in the timezone_richcompare, it should be a comparison against PyDateTime_TimeZoneType not against PyDateTime_TZInfoType. The segfault is due to an invalid casting to PyDateTime_TimeZoneType (the child) from the parent (PyDateTime_TZInfoType). |
Thanks, Tom and Karthikeyan for the finding and the debugging :) |
(Removing “3.7regression” as the problematic change for 3.7 had not yet been released.) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: