Skip to content

bpo-41299: QueryPerformanceFrequency() cannot fail #28552

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

Merged
merged 2 commits into from
Sep 24, 2021
Merged

bpo-41299: QueryPerformanceFrequency() cannot fail #28552

merged 2 commits into from
Sep 24, 2021

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 24, 2021

py_win_perf_counter_frequency() no longer checks for
QueryPerformanceFrequency() failure. According to the
QueryPerformanceFrequency() documentation, the function can no longer
fails since Windows XP.

https://bugs.python.org/issue41299

py_win_perf_counter_frequency() no longer checks for
QueryPerformanceFrequency() failure. According to the
QueryPerformanceFrequency() documentation, the function can no longer
fails since Windows XP.
return -1;
}
// Since Windows XP, the function cannot fail.
(void)QueryPerformanceFrequency(&freq);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why query this every time? It's fixed at boot, so it isn't going to change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function must be called exactly once in a process: py_get_win_perf_counter() uses a static variable for that.

@vstinner vstinner merged commit f35ddf2 into python:main Sep 24, 2021
@vstinner vstinner deleted the perf_counter_freq branch September 24, 2021 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants