Skip to content

test(json_decoder): guard simplejson encoding-kwarg tolerance (unblocks v6.0.2)#15

Merged
cloudingenium-automation[bot] merged 1 commit into
masterfrom
fix/jsondecoder-simplejson-encoding
Jun 24, 2026
Merged

test(json_decoder): guard simplejson encoding-kwarg tolerance (unblocks v6.0.2)#15
cloudingenium-automation[bot] merged 1 commit into
masterfrom
fix/jsondecoder-simplejson-encoding

Conversation

@cloudingenium-automation

Copy link
Copy Markdown

What

Adds a regression test guarding the JSONDecoder simplejson-encoding-kwarg tolerance fix (commit e49c9cb, already on master).

Why

requests routes response.json(cls=JSONDecoder) through simplejson whenever python3-simplejson is importable (it's an apt system package on several CloudIngenium hosts). simplejson.loads injects an obsolete encoding= kwarg that stdlib json.JSONDecoder.__init__ rejects on Python 3.9+:

TypeError: JSONDecoder.__init__() got an unexpected keyword argument 'encoding'

e49c9cb fixed this by kwargs.pop("encoding", None), but the fix was untested and — critically — never released in a tag. v6.0.1 (2026-03-31) predates the fix (2026-04-24). A live BfxLendingBot deploy that pip-installed @v6.0.1 crashed on init with this exact TypeError on a host with python3-simplejson; CI never caught it because CI's clean env has no system simplejson.

This PR adds the missing guard so the fix can't silently regress. It clears the path to a v6.0.2 release that BfxLendingBot can pin to (replacing the temporary site-package hotfix currently keeping the live bot up).

Test

test_tolerates_simplejson_encoding_kwarg constructs JSONDecoder(encoding="utf-8") and asserts a clean decode. Without the fix this raises TypeError (verified). 13/13 decoder tests pass.

🤖 Generated with Claude Code

…erance

Guards the e49c9cb fix that swallows simplejson's obsolete encoding=
kwarg (injected by requests via simplejson on Python 3.9+, rejected by
stdlib json.JSONDecoder). The fix was untested until now; a live
BfxLendingBot deploy of v6.0.1 (which predates e49c9cb) crashed on init
with this exact TypeError, motivating a v6.0.2 release plus this guard.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudingenium-automation
cloudingenium-automation Bot merged commit e133509 into master Jun 24, 2026
3 of 6 checks passed
@cloudingenium-automation
cloudingenium-automation Bot deleted the fix/jsondecoder-simplejson-encoding branch June 24, 2026 20:41
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.

0 participants