Closed marcinsulikowski closed 5 months ago
I posted PR #432 which should fix this crash.
Thank you for the clear report and PR. I didn’t like the change you proposed though, because it would be best to keep calling travel()
side-effect free. I would rather time-machine didn’t patch modules until needed, to reduce its overhead and the chance of bugs in processes that import but don’t run tests.
I went with an alternative approach in #433. Note that I included a test that uses a subprocess, which reproduces the issue before the patch.
Released in 2.14.1.
Thank you for fixing this so quickly :+1:
Thank you for the clear report. As you may see above, a segfault was reported several times but I never could track down the cause.
I tooted and tweeted about your report :) https://fosstodon.org/@adamchainz/112144774490159195
Python Version
3.12
pytest Version
No response
Package Version
2.14.0
Description
The following Python script:
crashes due to a segmentation fault in the constructor of the
travel
class.The crash happens when the constructor tries to determine the destination timestamp like this:
where
time()
callsresult = _time_machine.original_time()
which crashes if time_machine's patches are not applied yet and thus theoriginal_time
function pointer is stillNULL
.