fix: avoid IndexError when sizing a zero-column titled table - #483
Closed
santhreal wants to merge 2 commits into
Closed
fix: avoid IndexError when sizing a zero-column titled table#483santhreal wants to merge 2 commits into
santhreal wants to merge 2 commits into
Conversation
Empty PrettyTable instances with a title (or min_table_width) tried to grow widths[-1] even when there were no columns. Skip width scaling when the widths list is empty so get_string still returns a table.
Member
|
You've opened many PRs across these repos two weeks ago, and then closed them with no comment: python-humanize/humanize#352 Please could you explain why? Also hundreds in other repos:
|
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.

PrettyTable._compute_widths hits IndexError when get_string(title=...) with zero columns. This PR fixes the regression with a focused test covering the case.