Skip to content

Commit

Permalink
Python 3: except exception, e -> except exception as e. Re nvaccess#7105
Browse files Browse the repository at this point in the history
.
  • Loading branch information
josephsl committed May 25, 2019
1 parent 8898bab commit e90d6fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion source/NVDAObjects/IAccessible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,8 @@ def __init__(self,windowHandle=None,IAccessibleObject=None,IAccessibleChildID=No
try:
left,top,width,height = IAccessibleObject.accLocation(0)
windowHandle=winUser.user32.WindowFromPoint(winUser.POINT(left,top))
except COMError, e:
# Py3 review required: Syntax of the form "except exception, e" is gone in Python 3, replaced by "except exception as e".
except COMError as e:
log.debugWarning("accLocation failed: %s" % e)
if not windowHandle:
raise InvalidNVDAObject("Can't get a window handle from IAccessible")
Expand Down
3 changes: 2 additions & 1 deletion source/NVDAObjects/IAccessible/adobeFlash.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def _getStoryText(self):
def _getRawSelectionOffsets(self):
try:
return self.obj.ISimpleTextSelectionObject.GetSelection()
except COMError, e:
# Py3 review required: Syntax of the form "except exception, e" is gone in Python 3, replaced by "except exception as e".
except COMError as e:
if e.hresult == hresult.E_FAIL:
# The documentation says that an empty field should return 0 for both values, but instead, we seem to get E_FAIL.
# An empty field still has a valid caret.
Expand Down
3 changes: 2 additions & 1 deletion source/nvwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ def _feedUnbuffered(self, data, onDone=None):
try:
with self._global_waveout_lock:
winmm.waveOutWrite(self._waveout, LPWAVEHDR(whdr), sizeof(WAVEHDR))
except WindowsError, e:
# Py3 review required: Syntax of the form "except exception, e" is gone in Python 3, replaced by "except exception as e".
except WindowsError as e:
self.close()
raise e
self.sync()
Expand Down

0 comments on commit e90d6fb

Please sign in to comment.