pywin32
pywin32 copied to clipboard
`PyCColorDialog.SetCustomColors` returns error without setting exception
For all bugs, please provide the following information:
Expected behavior and actual behavior
Calling SetCustomColors should raise a descriptive exception, namely: TypeError: The argument must be a sequence of integers of length 1-16. But instead you get SystemError: error return without exception set.
https://github.com/mhammond/pywin32/blob/825834883a198e9b56301a4cda1694477169a488/Pythonwin/win32dlg.cpp#L1292-L1309
Steps to reproduce the problem
import win32ui
win32ui.CreateColorDialog(0, 0).SetCustomColors() # SystemError: error return without exception set
win32ui.CreateColorDialog(0, 0).SetCustomColors([]) # SystemError: error return without exception set
win32ui.CreateColorDialog(0, 0).SetCustomColors([0]) # OK
win32ui.CreateColorDialog(0, 0).SetCustomColors((0,0)) # OK
win32ui.CreateColorDialog(0, 0).SetCustomColors((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)) # SystemError: error return without exception set
System information
Python version and distribution: 3.10.11
pywin32 version: 310
Windows Version: 10.0.19045 Build 19045
DLL locations: N/A