GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(utils): match_regex_list crashes on an empty-string pattern by devteamaegis · Pull Request #6505 · getsentry/sentry-python Conversation
Contributor
What's broken
>>> from sentry_sdk.utils import match_regex_list >>> match_regex_list("anything", [""]) IndexError: string index out of range
Why it happensIndexing FixShort-circuit on empty: TestAdded a case asserting Fixes #6504
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
ericapisani
requested changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for opening the issue and pull request to address this. There's a couple of things we'll need to address before this gets merged - let me know if you have any questions about what I've mentioned below.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than have this be a standalone test, this case can be incorporated into the test above ( This means that last 2 assertions around foo/foobar can also be removed since we already have test cases that check similar behaviour within the array (lines 553 and 554 above)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this fixes the index error, the result that's returned from this change means An empty string likely represents a typo/mistake on the developers part, and so we should treat this as if This would mean that this conditional should look like the following instead: for item_matcher in regex_list: if not item_matcher: return False if not substring_matching and item_matcher[-1] != "$": item_matcher += "$"
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
devteamaegis
force-pushed
the
fix/match-regex-list-empty-string
branch
from
4043b13 to
d42a94a
Compare
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cursor Bugbot has reviewed your changes and found 1 potential issue. ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard. Reviewed by Cursor Bugbot for commit d42a94a. Configure here.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page.
Comment on lines
1743
to
1744
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: An empty string Suggested FixInstead of converting an empty Prompt for AI AgentAlso affects:
Did we get this right? 👍 / 👎 to inform future reviews.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…_list Address review feedback: an empty string in regex_list represents a typo/mistake and should be treated as if [] was passed, returning False rather than matching every item. Fold the regression case into the parameterized test_match_regex_list cases and drop the redundant standalone test.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabelsProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. match_regex_list raises IndexError when a pattern list contains an empty stringUh oh!
There was an error while loading. Please reload this page. 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. | ||||||||||||||||||||||||||||||||||
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |