Skip to content

Fix string identity comparison bug in balance.py menu handling - #2

Open
mdellison90-stack with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-bug-in-order-processing
Open

Fix string identity comparison bug in balance.py menu handling#2
mdellison90-stack with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-bug-in-order-processing

Conversation

Copilot AI commented Jan 25, 2026

Copy link
Copy Markdown

String comparisons in balance.py used is (identity check) instead of == (equality check), causing undefined behavior when matching user input against menu options.

Changes

  • balance.py: Replace is with == for string comparisons (lines 73, 83, 84)
# Before
if option is '1':
    ...
elif option is '3':
    ...
elif option is '4':
    ...

# After  
if option == '1':
    ...
elif option == '3':
    ...
elif option == '4':
    ...

The is operator checks object identity, not value equality. While string interning may make this work for literals in the REPL, it fails unpredictably with user input from input().

Original prompt

Reference: 694c574


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: mdellison90-stack <230609064+mdellison90-stack@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bug in order processing functionality Fix string identity comparison bug in balance.py menu handling Jan 25, 2026
@mdellison90-stack
mdellison90-stack marked this pull request as ready for review March 23, 2026 08:51
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.

2 participants