-
Notifications
You must be signed in to change notification settings - Fork 782
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
fix segmentation fault when datetime
module is invalid
#3818
Conversation
CodSpeed Performance ReportMerging #3818 will degrade performances by 16.95%Comparing Summary
Benchmarks breakdown
|
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.
Two nits. Otherwise LGTM.
I guess an invalid module on the path is weird enough that this does not need an immediate backport and 0.20.x maintenance release? This module did change significantly since 0.20.x IIRC.
43080b3
to
5b11041
Compare
Thanks for the review 👍
Yes, I think it is a weird edge case. I think it's also very likely that this will always just crash immediately without doing any harm, so it's just ugly UX rather than dangerous. That said, I'm about to prepare a patch release for #3619, so if it's trivial to cherry-pick this I will. |
Reported downstream in pydantic/pydantic-core#1171
We aren't checking if
PyDatetime_IMPORT()
succeeds, which can lead to dereference of a null pointer and a crash if the import fails.This PR fixes that crash by adding error checking. Where possible I return the error, otherwise I just panic.