bpo-36638: fix WindowsLoadTracker exception on small windows SKUs#12849
bpo-36638: fix WindowsLoadTracker exception on small windows SKUs#12849zooba merged 6 commits intopython:masterfrom
Conversation
There was a problem hiding this comment.
Whoops, I assumed typeperf would be available on all supported Windows editions. I think this fix might leave some open handles around, the pipe_write_end and self.pipe in win_utils but this might not be a big concern since its just for the duration of the test suite run.
Aside from that, looks good to me.
|
I'd rather expand the platform check to exclude ARM. That way we'll find out about changes here in the future faster (when it breaks, rather than when we notice a warning). |
|
This isn't an ARM issue. It makes more sense to check for the existence of c:\windows\system32\typeperf.exe, or typeperf.exe on the path, than to limit it to arm. I'm not sure which might be more pythonic. The missing dependency is what is causing the exception, not the processor architecture. |
|
In that case, handling the exception when it's not found is better. Sorry to send you back to the first commit (but fix up the formatting while you're there - no space between function call ( |
|
No problem. I'm happy to learn. Alos, are there any VS Code addins or other tools that will help me get the whitespace right before I create the PR? |
|
Using a linter like pylint will catch trailing whitespace issues like those https://code.visualstudio.com/docs/python/linting (Note that some of the stdlib doesn't conform to pep8, so you might run into some false positives) If you don't want to use a full blown linter, for that particular issue you could use something like https://marketplace.visualstudio.com/items?itemName=shardulm94.trailing-spaces |
Lib/test/libregrtest/main.py
Outdated
| except FileNotFoundError as error: | ||
| # Windows IoT Core and Windows Nano Server do not provide | ||
| # typeperf.exe for x64, x86 or ARM | ||
| print('Failed to create WindowsLoadTracker: {}'.format(str(error))) |
There was a problem hiding this comment.
The str() call here is redudant, an empty format specifier is essentially the same as calling str()
A general convention is that an empty format string ("") produces the same result as if you
had called str() on the value. A non-empty format string typically modifies the result.
https://docs.python.org/3/library/string.html#format-specification-mini-language
typeperf.exe is not present on small editions
of windows like Windows IoT Core or nanoserver
This causes WindowsLoadTracker to throw an exception during test initialization.
@ammaraskar @zooba
https://bugs.python.org/issue36638