Skip to content

Fix gen_colors docstring: function yields, not returns a list#145288

Open
Anandesh-Sharma wants to merge 1 commit intopython:mainfrom
Anandesh-Sharma:fix-pyrepl-gen-colors-docstring
Open

Fix gen_colors docstring: function yields, not returns a list#145288
Anandesh-Sharma wants to merge 1 commit intopython:mainfrom
Anandesh-Sharma:fix-pyrepl-gen-colors-docstring

Conversation

@Anandesh-Sharma
Copy link

Summary

  • Fix misleading docstring in Lib/_pyrepl/utils.py::gen_colors()
  • The function is a generator (uses yield) with return type Iterator[ColorSpan], but the docstring stated "Returns a list of index spans"
  • Updated to "Yield index spans" to accurately describe the generator behavior

Test plan

  • Verify function behavior unchanged (docstring-only change)
  • python -m pytest Lib/test/test_pyrepl/ passes

The gen_colors function is a generator (uses yield) with return type
Iterator[ColorSpan], but its docstring incorrectly stated "Returns a
list of index spans". Updated to "Yield index spans" to accurately
reflect the function's behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

@bedevere-app
Copy link

bedevere-app bot commented Feb 26, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant