chore: drop unnecessary | None on LLMError and Mail.send#36147
Merged
asukaminato0721 merged 1 commit intoMay 14, 2026
Merged
Conversation
LLMError.description and Mail.send(from_=...) are always assigned a string in practice and the bodies never distinguish between None and an empty string. Tighten the annotations to str and default to "" so the types match actual usage. Refs langgenius#35557
Contributor
Pyrefly Type Coverage
|
asukaminato0721
approved these changes
May 14, 2026
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.
Summary
Refs #35557.
A couple of small spots where the
| Noneannotation was carrying noreal information and the body never distinguished between
Noneand aplain empty string. Tighten them to
strwith a""default so thetypes match actual usage.
This is a follow-on cleanup in the same spirit as #36135, but for
different files.
Changes
api/core/errors/error.py:LLMError.descriptionandLLMError.__init__(description=...)—str | None = None→str = "".No subclass or caller relies on
description is None; the field is onlyset/read as a string.
api/extensions/ext_mail.py:Mail.send(from_=...)—str | None = None→str = "". The body usesif not from_:then fallsback to
self._default_send_from, so an empty string andNonearealready equivalent. The only non-test caller
(
tasks/mail_human_input_delivery_task.py) does not passfrom_.Notes
in the issue thread, but several of them have call sites that pass
Noneexplicitly or rely onis Nonesemantics, so they need morethought than a mechanical rewrite.
still cover the default-
from_path, andLLMError.descriptionhas notest that checks the
Nonecase.