commit/resourceMonitor: josephsl: OpenKeyEx: Python 2 version does not deal with keyword arguments.

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Tue, 05 Nov 2019 19:30:47 +0000 (UTC)

1 new commit in resourceMonitor:

https://bitbucket.org/nvdaaddonteam/resourcemonitor/commits/8a67d9271617/
Changeset:   8a67d9271617
Branch:      stable
User:        josephsl
Date:        2019-11-05 19:30:29+00:00
Summary:     OpenKeyEx: Python 2 version does not deal with keyword arguments.

Regression: python 2's _winreg.OpenKeyEx function does not accept keyword 
arguments, leading to Windows version info command (NVDA+Shift=Number 6) not 
working on NVDA 2019.2.1 on 64-bit systems. Thus check to make surecorrect 
function signature is called depending on Python version in use (does not 
affect NVDA 2019.3.).

Affected #:  1 file

diff --git a/addon/globalPlugins/resourceMonitor/__init__.py 
b/addon/globalPlugins/resourceMonitor/__init__.py
index b6ec141..0fd0bfe 100644
--- a/addon/globalPlugins/resourceMonitor/__init__.py
+++ b/addon/globalPlugins/resourceMonitor/__init__.py
@@ -169,7 +169,11 @@ def _win10RID(buildNum, isClient):
        # Because NVDA is a 32-bit application, 64-bit view of Registry must be 
attempted for self-host key.
        currentVersion = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 
r"Software\Microsoft\Windows NT\CurrentVersion")
        if os.environ.get("PROCESSOR_ARCHITEW6432") in ("AMD64","ARM64"):
-               selfHostApplicability = 
winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, 
r"Software\Microsoft\WindowsSelfHost\Applicability", access=winreg.KEY_READ | 
winreg.KEY_WOW64_64KEY)
+               # Python 2 does not allow keyword arguments for OpenKeyEx.
+               if sys.version.startswith("3"):
+                       selfHostApplicability = 
winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, 
r"Software\Microsoft\WindowsSelfHost\Applicability", access=winreg.KEY_READ | 
winreg.KEY_WOW64_64KEY)
+               else:
+                       selfHostApplicability = 
winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, 
r"Software\Microsoft\WindowsSelfHost\Applicability", 0, winreg.KEY_READ | 
winreg.KEY_WOW64_64KEY)
        else:
                selfHostApplicability = 
winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, 
r"Software\Microsoft\WindowsSelfHost\Applicability")
        # Version 1511 and later.

Repository URL: https://bitbucket.org/nvdaaddonteam/resourcemonitor/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.

Other related posts:

  • » commit/resourceMonitor: josephsl: OpenKeyEx: Python 2 version does not deal with keyword arguments. - commits-noreply