Skip to content

Python 3: except exception, e -> except as e - #9698

Merged
michaelDCurran merged 6 commits into
nvaccess:threshold_py3_stagingfrom
josephsl:py3exceptionSyntax
Jun 9, 2019
Merged

Python 3: except exception, e -> except as e#9698
michaelDCurran merged 6 commits into
nvaccess:threshold_py3_stagingfrom
josephsl:py3exceptionSyntax

Conversation

@josephsl

@josephsl josephsl commented Jun 8, 2019

Copy link
Copy Markdown
Contributor

Link to issue number:

None

Summary of the issue:

Python 3 does not allow excewption assignment of the form "except, e" but rather prefers "except as e".

Description of how this pull request fixes the issue:

Edit all instances of the former syntax to the new one.

Steps:

  1. Use grep to look for ", e:".
  2. Edit the instances found, looking carefully at context around them.

Testing performed:

Tested with Python 2 and 3 interpreters, along with source code copies.

Known issues with pull request:

None, although there is one instance where UnicodeDecodeError is raised, which may indicate Python 2 assumptions.

Change log entry:

None

josephsl added 6 commits June 8, 2019 07:00
In Python 2, the exception statement of the form 'except exception, e' was acceptable, no longer the case in Python 3 (requires 'except exception as e'). Thus use the latter in IAccessible objects and others.
…> (configobj.ConfigObjError,UnicodeDecodeError) as e.
@josephsl
josephsl requested a review from michaelDCurran June 8, 2019 14:38
@feerrenrut
feerrenrut changed the base branch from threshold to threshold_py3_staging June 8, 2019 14:56
@michaelDCurran
michaelDCurran merged commit e18c5f4 into nvaccess:threshold_py3_staging Jun 9, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.3 milestone Jun 9, 2019
@josephsl
josephsl deleted the py3exceptionSyntax branch September 16, 2019 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants