ZeroDivisionError in Python-2.7.3/Lib/colorsys.py

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

In Python-2.7.3/Lib/colorsys.py, inspect rgb_to_hls around lines 72–77 and reproduce the zero-denominator case. Apply the requested handling there and check the corresponding Python 3 library implementation, then verify rgb_to_hls returns the expected tuple without raising ZeroDivisionError.

Written by the indexing model from the issue text.

Description

line 77 in rgb_to_hls divides by 2.0-maxc-minc which is sometimes zero.
Fix by inserting before line 74
if (2.0-maxc-minc) == 0:
return(0.0, l, 0.0)
similar to lines 72-73.
Error also exists in python 3 library.

Dominant language
Python
Stars
3
Forks
12
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from enthought/Python-2.7.3

All issues in enthought/Python-2.7.3

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.