Fix rare recursion error in the winVersion module#12696
Conversation
|
cc @josephsl Would you be able to review this? |
josephsl
left a comment
There was a problem hiding this comment.
@feerrenrut, any thoughts since you asked for checking for Windows 10 Version 1507 and earlier in the original PR? I can see the possibility of an infinite recursion (my mistake). Apart from the "from None" statement, I think this should be part of 2021.2.
One way to optimize this (without opening Windows Registry) is checking for Windows releases from getWinVer function before calling the private function, which actually removes the ability of this function to handle corner cases like the one discussed in this PR. Another option is checking for build ranges by calling sys.getwindowsversion from the private function or passing the current release information (major.minor.build) to the private function as an optional argument, but then the function cannot natively handle release info being None. Therefore what this PR proposes is what I think is the best solution at the moment unless the actual root cause of the recursion error is found.
Thanks.
|
Hi, ah, I see – never came across that fragment before. Thanks.
|
…s the version of Windows on which we're running cannot be changed.
josephsl
left a comment
There was a problem hiding this comment.
Excellent - thanks for validating an optimization idea I had for the original PR.
Opened against beta since this PR fixes regression which should be fixed before 2021.2
Link to issue number:
Fixes #12666
Fix-up of #12544
Summary of the issue:
In some rare cases
winVersion.getWinVercan cause recursion errors since it callswinVersion._getRunningVersionNameFromWinRegwhich in turn executeswinVersion.getWinVerto check if the currently running version of Windows contains release info in the registry.A sample of the log posted in #12666 is as follows:
Description of how this pull request fixes the issue:
Rather than checking if the current version of Windows contains release info in the registry by comparing it to the lowest version for which this is supported I'm just checking if the necessary info exists in the registry and if not appropriate exceptions are raised.
To avoid pointless registry accesses result of
getWinVeris cached - version of Windows on which NVDA is running is not going to change during its lifetime.Testing strategy:
Started NVDA ensured it works in general.
Known issues with pull request:
None known
Change log entries:
None necessary - unreleased regression.
Code Review Checklist: