Fix #443: narrow bare except and remove dead code in inputs.py - #473
Open
prawnsgupta wants to merge 1 commit into
Open
Fix #443: narrow bare except and remove dead code in inputs.py#473prawnsgupta wants to merge 1 commit into
prawnsgupta wants to merge 1 commit into
Conversation
- Replace bare 'except:' in create_number_wire() with 'except FileNotFoundError:' (matches create_readonly_wire) and fix its indentation to 4 spaces - Remove unused _init_enabled() (self-documented as redundant; no callers found repo-wide) and the now-unused Condition import - Remove leftover commented-out line and convert the resolved TODO in the enabled setter into a normal explanatory comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #443 @jmplaza @BkPankaj
Changes in
backend/staticfiles/synthesis/lib/inputs.pyexcept:increate_number_wire()toexcept FileNotFoundError:. A bare except also swallowsKeyboardInterrupt/SystemExitand can hide real bugs;FileNotFoundErroris the specific exceptionSharedMemory(name=...)raises when the block doesn't exist yet, and matches howcreate_readonly_wire()already handles it. Also normalized the function's indentation to 4 spaces._init_enabled()method. Its own comment marked it redundant, a repo-wide grep finds no callers, and it references a non-existentself.enable_wireattribute, so it would raiseAttributeErrorif ever called.Conditionimport (it was only referenced by the deleted method) and a leftover commented-out line (# self.shms.append(shm)), which referencedselfinside a plain function.enabledsetter into a normal explanatory comment, per the issue.Verification
python -m py_compile backend/staticfiles/synthesis/lib/inputs.pypassesgrep -rn "_init_enabled"across the repo returns no remaining referencesDiff: 1 file, +9/−17.