Skip to content

fix: Revert change to write_timestamp - #423

Merged
rebkwok merged 1 commit into
mainfrom
fix-timestamp-write
Aug 12, 2026
Merged

fix: Revert change to write_timestamp#423
rebkwok merged 1 commit into
mainfrom
fix-timestamp-write

Conversation

@rebkwok

@rebkwok rebkwok commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

This was changed due to ruff rule SIM115, which flagged that a context manager should be used to write to the timestamp file.
12eadba

However, on windows, writing to a file while there's already an open handle to it sometimes errors. The tests passed, but a user has encountered the error now.

The previous workaround was a bit odd, and involved opening a temp file with delete=False, immediately closing it, writing to it and then manually cleaning it up afterwards. A cleaner and more ruff-friendly way is to use a temp directory instead, and write to a file inside it without opening the file.

Related Slack thread:
https://bennettoxford.slack.com/archives/C0270Q313H7/p1786459860969619

This was changed due to ruff rule SIM115, which flagged that a
context manager should be used to write to the timestamp file.
12eadba

However, on windows, writing to a file while there's already an
open handle to it _sometimes_ errors. The tests passed, but a
user has encountered the error now.

The previous workaround was a bit odd, and involved opening a
temp file with delete=False, immediately closing it, writing to it
and then manually cleaning it up afterwards. A cleaner and more
ruff-friendly way is to use a temp directory instead, and write to
a file inside it without opening the file.
@rebkwok
rebkwok merged commit f0eaa78 into main Aug 12, 2026
8 checks passed
@rebkwok
rebkwok deleted the fix-timestamp-write branch August 12, 2026 08:17
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.

2 participants