#26483 closed defect (fixed)

Static check results in "local variable 'exc' is assigned to but never used"

Reported by: dmr Owned by: dmr
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Normal Keywords:
Cc: atagar Actual Points:
Parent ID: Points:
Reviewer: atagar Sponsor:

Description

pyflakes updated to 2.0.0 now additionally "[checks] for unused exception binding in except: block", causing the following lint errors:

STATIC CHECKS
* /path/to/stem/descriptor/reader.py
  line 515  - local variable 'exc' is assigned to but never used | except TypeError as exc:

* /path/to/stem/util/system.py
  line 1327 - local variable 'exc' is assigned to but never used | except CallTimeoutError as exc:

* /path/to/stem/interpreter/__init__.py
  line 148  - local variable 'exc' is assigned to but never used | except (KeyboardInterrupt, stem.SocketClosed) as exc:
  line 172  - local variable 'exc' is assigned to but never used | except stem.SocketClosed as exc:
  line 184  - local variable 'exc' is assigned to but never used | except (KeyboardInterrupt, EOFError, stem.SocketClosed) as exc:

line numbers as of 3818cf41cae98ae7558f5002ef3a5152ede5b2fb

Strangely, those only appear for py35 runs - I didn't see them in my py27 runs. Not sure why that is.

Child Tickets

Change History (2)

comment:1 Changed 15 months ago by dmr

Reviewer: atagar
Status: assignedneeds_review

A simple patch is available on this GitHub pull request. (Branch head ebc9cdac9293e601a9351905105493ec9ea3abcf.)

I reviewed the implementation to see if it made sense to include something from / do something with the exc variable in these code blocks. It didn't look like it, so the commit just removes the as exc part.

comment:2 Changed 15 months ago by atagar

Resolution: fixed
Status: needs_reviewclosed

Thanks Dave, great catch! Merged. Also manually synced the github repo again to pick up all the work merged over the weekend.

Note: See TracTickets for help on using tickets.