@@ -1144,6 +1144,16 @@ _color_set_hsva(pgColorObject *color, PyObject *value, void *closure)
1144
1144
return -1 ;
1145
1145
}
1146
1146
1147
+ if (PySequence_Size (value ) > 4 ) {
1148
+ if (PyErr_WarnEx (
1149
+ PyExc_DeprecationWarning ,
1150
+ "Passing sequences of size larger than 4 is deprecated, doing "
1151
+ "this will error in a future version" ,
1152
+ 1 ) == -1 ) {
1153
+ return -1 ;
1154
+ }
1155
+ }
1156
+
1147
1157
/* H */
1148
1158
item = PySequence_GetItem (value , 0 );
1149
1159
if (!item || !_get_double (item , & (hsva [0 ])) || hsva [0 ] < 0 ||
@@ -1309,6 +1319,16 @@ _color_set_hsla(pgColorObject *color, PyObject *value, void *closure)
1309
1319
return -1 ;
1310
1320
}
1311
1321
1322
+ if (PySequence_Size (value ) > 4 ) {
1323
+ if (PyErr_WarnEx (
1324
+ PyExc_DeprecationWarning ,
1325
+ "Passing sequences of size larger than 4 is deprecated, doing "
1326
+ "this will error in a future version" ,
1327
+ 1 ) == -1 ) {
1328
+ return -1 ;
1329
+ }
1330
+ }
1331
+
1312
1332
/* H */
1313
1333
item = PySequence_GetItem (value , 0 );
1314
1334
if (!item || !_get_double (item , & (hsla [0 ])) || hsla [0 ] < 0 ||
@@ -1469,6 +1489,21 @@ _color_set_i1i2i3(pgColorObject *color, PyObject *value, void *closure)
1469
1489
1470
1490
DEL_ATTR_NOT_SUPPORTED_CHECK ("i1i2i3" , value );
1471
1491
1492
+ if (!PySequence_Check (value ) || PySequence_Size (value ) < 3 ) {
1493
+ PyErr_SetString (PyExc_ValueError , "invalid I1I2I3 value" );
1494
+ return -1 ;
1495
+ }
1496
+
1497
+ if (PySequence_Size (value ) > 3 ) {
1498
+ if (PyErr_WarnEx (
1499
+ PyExc_DeprecationWarning ,
1500
+ "Passing sequences of size larger than 3 is deprecated, doing "
1501
+ "this will error in a future version" ,
1502
+ 1 ) == -1 ) {
1503
+ return -1 ;
1504
+ }
1505
+ }
1506
+
1472
1507
/* I1 */
1473
1508
item = PySequence_GetItem (value , 0 );
1474
1509
if (!item || !_get_double (item , & (i1i2i3 [0 ])) || i1i2i3 [0 ] < 0 ||
@@ -1536,6 +1571,21 @@ _color_set_cmy(pgColorObject *color, PyObject *value, void *closure)
1536
1571
1537
1572
DEL_ATTR_NOT_SUPPORTED_CHECK ("cmy" , value );
1538
1573
1574
+ if (!PySequence_Check (value ) || PySequence_Size (value ) < 3 ) {
1575
+ PyErr_SetString (PyExc_ValueError , "invalid CMY value" );
1576
+ return -1 ;
1577
+ }
1578
+
1579
+ if (PySequence_Size (value ) > 3 ) {
1580
+ if (PyErr_WarnEx (
1581
+ PyExc_DeprecationWarning ,
1582
+ "Passing sequences of size larger than 3 is deprecated, doing "
1583
+ "this will error in a future version" ,
1584
+ 1 ) == -1 ) {
1585
+ return -1 ;
1586
+ }
1587
+ }
1588
+
1539
1589
/* I1 */
1540
1590
item = PySequence_GetItem (value , 0 );
1541
1591
if (!item || !_get_double (item , & (cmy [0 ])) || cmy [0 ] < 0 || cmy [0 ] > 1 ) {
0 commit comments