Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw RuntimeError from .pop() when stack is empty #83

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

ikalnytskyi
Copy link
Owner

The picobox.pop() function used to throw IndexError when invoked with an empty stack. This was never an intentional move, and just happened because we weren't careful enough.

This patch makes the .pop() function to throw RuntimeError instead with a good-looking error message saying that there's no boxes on stack, similar to what picobox.put() or picobox.get() are doing.

This patch doesn't introduce a major bump in the version despite being a backward incompatible change. Invoking .pop() when stack is empty is a symptom of a poorly designed application, and should not be happening in the first place.

The `picobox.pop()` function used to throw `IndexError` when invoked
with an empty stack. This was never an intentional move, and just
happened because we weren't careful enough.

This patch makes the `.pop()` function to throw `RuntimeError` instead
with a good-looking error message saying that there's no boxes on stack,
similar to what `picobox.put()` or `picobox.get()` are doing.

This patch doesn't introduce a major bump in the version despite being a
backward incompatible change. Invoking `.pop()` when stack is empty is a
symptom of a poorly designed application, and should not be happening in
the first place.
@ikalnytskyi ikalnytskyi merged commit 62666e4 into master Nov 30, 2023
14 checks passed
@ikalnytskyi ikalnytskyi deleted the bug/pop-runtimeerror branch November 30, 2023 00:45
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