Open alanjds opened 6 years ago
@Fedorov688 Thanks for reporting, but this is a bit hard to understand. Do this work on CPython and is broken on Grumpy?
I will close for now until more feedback is provided. Please reopen if you can confirm that it works on CPython and fails on Grumpy.
google/grumpy#398 opened by @Fedorov688 on Feb 27
Hi, if i use this function (colorsys.rgb_to_hls(r, g, b)) and, for example, my data r = 0, g = 1, b = 2 or r = 0, g = 0, b = 2. I get an error. My crutch in this problem: if (r + g + b) == 2 or (r + g + b) == 3 or (r + g + b) == 4 and r == 2: r = 3 print("crutch") elif (r + g + b) == 2 or (r + g + b) == 3 or (r + g + b) == 4 and g == 2: g = 3 print("crutch") elif (r + g + b) == 2 or (r + g + b) == 3 or (r + g + b) == 4 and b == 2: b = 3 print("crutch") try: hls_tmp = colorsys.rgb_to_hls(r, g, b) except(ZeroDivisionError): print(r, g, b) exit(0)
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/colorsys.py#L81