Skip to content

gh-99999: Refactor hsv_to_rgb in colorsys to remove dead code branch#154501

Open
StepashkaHollow wants to merge 6 commits into
python:mainfrom
StepashkaHollow:fix-colorsys-dead-code
Open

gh-99999: Refactor hsv_to_rgb in colorsys to remove dead code branch#154501
StepashkaHollow wants to merge 6 commits into
python:mainfrom
StepashkaHollow:fix-colorsys-dead-code

Conversation

@StepashkaHollow

@StepashkaHollow StepashkaHollow commented Jul 22, 2026

Copy link
Copy Markdown

The if i == 5: check in hsv_to_rgb is redundant because i = i % 6 guarantees that i will be between 0 and 5. If it's not 0, 1, 2, 3, or 4, it must be 5.

Replacing it with else: simplifies the logic and achieves 100% test coverage for colorsys.py (removing the uncovered 164->exit branch).

@bedevere-app

bedevere-app Bot commented Jul 22, 2026

Copy link
Copy Markdown

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.

@StepashkaHollow StepashkaHollow changed the title bpo-00000: Refactor hsv_to_rgb in colorsys to remove dead code branch Refactor hsv_to_rgb in colorsys to remove dead code branch Jul 22, 2026
@StepashkaHollow

Copy link
Copy Markdown
Author

@bedevere check

@bedevere-app

bedevere-app Bot commented Jul 22, 2026

Copy link
Copy Markdown

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.

@python-cla-bot

python-cla-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@StepashkaHollow

Copy link
Copy Markdown
Author

@bedevere check

@StepashkaHollow StepashkaHollow changed the title Refactor hsv_to_rgb in colorsys to remove dead code branch gh-00000:Refactor hsv_to_rgb in colorsys to remove dead code branch Jul 22, 2026
@bedevere-app

bedevere-app Bot commented Jul 22, 2026

Copy link
Copy Markdown

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.

@bedevere-app

bedevere-app Bot commented Jul 22, 2026

Copy link
Copy Markdown

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.

@StepashkaHollow StepashkaHollow changed the title gh-00000:Refactor hsv_to_rgb in colorsys to remove dead code branch gh-99999: Refactor hsv_to_rgb in colorsys to remove dead code branch Jul 22, 2026
@bedevere-app

bedevere-app Bot commented Jul 22, 2026

Copy link
Copy Markdown

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