Skip to content

fix(python): complete Stopwatch semantics and API - #5104

Open
dbrattli wants to merge 2 commits into
mainfrom
fix/python-simon-parity
Open

dbrattli wants to merge 2 commits into
mainfrom
fix/python-simon-parity

Conversation

@dbrattli

Copy link
Copy Markdown
Collaborator

Summary

Python already exposed parts of System.Diagnostics.Stopwatch, but its instance methods raised for ordinary repeated calls, elapsed time was unavailable while running, and ElapsedTicks did not use the units declared by Frequency.

This completes the Python mapping and runtime implementation for StartNew, Restart, Elapsed, GetElapsedTime, and IsHighResolution. It uses perf_counter_ns consistently for timestamps and elapsed ticks, accumulates across start/stop cycles, and retains the existing TimerError export for Python callers.

The F# regressions cover running and stopped elapsed time, repeated calls, restart/reset, and timestamp unit conversion on .NET and generated Python.

Python counterpart to #5100.

@github-actions

Copy link
Copy Markdown
Contributor

Python Type Checking Results (Pyright)

Metric Value
Total errors 33
Files with errors 4
Excluded files 4
New errors ✅ No
Excluded files with errors (4 files)

These files have known type errors and are excluded from CI. Remove from pyrightconfig.ci.json as errors are fixed.

File Errors Status
temp/tests/Python/test_hash_set.py 18 Excluded
temp/tests/Python/test_applicative.py 11 Excluded
temp/tests/Python/test_nested_and_recursive_pattern.py 2 Excluded
temp/tests/Python/fable_modules/thoth_json_python/encode.py 2 Excluded

@dbrattli
dbrattli marked this pull request as draft October 16, 2026 20:23
@MangelMaxime
MangelMaxime force-pushed the fix/python-simon-parity branch from 8eb966e to d00a987 Compare October 21, 2026 18:27
@MangelMaxime
MangelMaxime requested a balanced review from Copilot October 21, 2026 18:42
@MangelMaxime
MangelMaxime marked this pull request as ready for review October 21, 2026 18:43
@MangelMaxime
MangelMaxime removed the request for review from Copilot October 21, 2026 18:43

This branch has not been deployed

No deployments
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