Skip to content

#79 Uses explicit None check for _client in OpenRouterClient.generate() - #103

Merged
deyna256 merged 1 commit into
deyna256:mainfrom
sathvik458:fix-client-none-guard
Mar 14, 2026
Merged

#79 Uses explicit None check for _client in OpenRouterClient.generate()#103
deyna256 merged 1 commit into
deyna256:mainfrom
sathvik458:fix-client-none-guard

Conversation

@sathvik458

@sathvik458 sathvik458 commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

__aexit__ uses assert self._client is not None, while generate() used a falsy check (if not self._client).

This change replaces the falsy check with an explicit None comparison (if self._client is None) to avoid relying on the truthiness behavior of httpx.AsyncClient and it should be alright.

All test cases have passed!

Resolve #79

@deyna256

Copy link
Copy Markdown
Owner

@sathvik458 thanks!

@deyna256
deyna256 merged commit 7ee5544 into deyna256:main Mar 14, 2026
3 checks passed
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.

Inconsistent _client None-guards: falsy check in generate() vs assertion in __aexit__

2 participants