Skip to content

fix: replace bare except with specific exceptions in solve_L, fix adj_cost docstring typo#1091

Open
suyash469 wants to merge 1 commit intoPSLmodels:masterfrom
suyash469:fix/firm-bare-except-and-docstring
Open

fix: replace bare except with specific exceptions in solve_L, fix adj_cost docstring typo#1091
suyash469 wants to merge 1 commit intoPSLmodels:masterfrom
suyash469:fix/firm-bare-except-and-docstring

Conversation

@suyash469
Copy link

Summary

Two small real bug fixes in ogcore/firm.py.

Changes

1. solve_L() — Replace bare except: with except (ValueError, TypeError):

The try/except block exists solely to detect whether K_g is a NumPy array
(comparing an array to a scalar raises ValueError) or an incompatible type
(TypeError). A bare except: silently catches KeyboardInterrupt, SystemExit,
and MemoryError, making long OG-Core runs impossible to interrupt and masking
real errors silently.

2. adj_cost() — Fix docstring typo

'adjstment''adjustment'

Validation

  • Confirmed zero bare except clauses remain in firm.py via AST check
  • Typo verified absent from source

…_cost docstring typo

- firm.py solve_L(): Replace bare except: with except (ValueError, TypeError):.
  The try/except exists only to detect whether K_g is an ndarray (comparison
  raises ValueError) or an incompatible type (TypeError). A bare except catches
  KeyboardInterrupt, SystemExit, MemoryError and other critical signals, making
  long OG-Core runs impossible to interrupt and masking real bugs silently.

- firm.py adj_cost(): Fix typo in docstring: 'adjstment' -> 'adjustment'.
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.

1 participant