Skip to content
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 System Error on Python 3.13 and Windows #457

Merged
merged 1 commit into from
Jun 29, 2024
Merged

Conversation

adamchainz
Copy link
Owner

Fixes #456.

The relevant crash from the test log actually seems to be the initial failure:

AttributeError: module 'time' has no attribute 'clock_gettime_ns'

The above exception was the direct cause of the following exception:

...

>       _time_machine.patch_if_needed()
E       SystemError: <built-in function patch_if_needed> returned a result with an exception set

PyObject_GetAttrString fails to get clock_gettime and clock_gettime_ns on Windows because they only exist on Unix. It returns NULL and each time sets the AttributeError as the current error. patch_if_needed did not clear this, leading to Python's call check to raise a SystemError caused by the AttributeError, making time-machine fail to start travelling.

I'm not sure which exact change in Python made this failure occur, so far it seems the SystemError should have been raised on older versions too. Ah well.

@gaborbernat I haven’t got a Windows setup for verifying this on - would you mind trying this on your test suite?

@gaborbernat
Copy link

@gaborbernat I haven’t got a Windows setup for verifying this on - would you mind trying this on your test suite?

I also do not have one :D used the Windows GHA to catch this :D

@adamchainz
Copy link
Owner Author

Okay, I tested on Windows in CI too, in #458. The test suite is not ready to run on Windows without more work, so I’m going to merge and release this without any test for now.

@adamchainz adamchainz merged commit d205a63 into main Jun 29, 2024
8 checks passed
@adamchainz adamchainz deleted the windows_system_error branch June 29, 2024 09:15
@adamchainz
Copy link
Owner Author

Please give 2.14.2 a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fails on 3.13.0b2 Windows
2 participants