fix: add None guard for params in get_balance_allowance and update_balance_allowance#307
Open
Sush78 wants to merge 1 commit intoPolymarket:mainfrom
Open
fix: add None guard for params in get_balance_allowance and update_balance_allowance#307Sush78 wants to merge 1 commit intoPolymarket:mainfrom
Sush78 wants to merge 1 commit intoPolymarket:mainfrom
Conversation
There was a problem hiding this comment.
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.
6d9e5b5 to
1b5554e
Compare
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.

Overview
Fix AttributeError crash in
get_balance_allowanceandupdate_balance_allowancewhen called withoutparamsargument.Description
Both methods declare
params: BalanceAllowanceParams = Noneas optional but immediately accessparams.signature_typewithout a None check. This causes an opaqueAttributeError: 'NoneType' object has no attribute 'signature_type'when called without params.This adds a guard at the top of each method that raises a clear
ValueError("params is required for ...")before accessing any attributes.No change to method signatures or behaviour for callers who pass params correctly.
This bug was also flagged during code review of #224.
Testing instructions
Run the new test file: pytest tests/test_balance_allowance.py
Types of changes
Notes
Fixes #306
Status
[WIP]if necessary (changes not yet made).Note
Low Risk
Low risk: adds early input validation and tests, without changing request construction for valid callers.
Overview
Fixes a crash in
ClobClient.get_balance_allowanceandClobClient.update_balance_allowanceby explicitly rejecting missingparamswith a clearValueErrorbefore accessingparams.signature_type.Adds unit tests asserting both methods raise when called without parameters.
Written by Cursor Bugbot for commit 1b5554e. This will update automatically on new commits. Configure here.