PySequence_Check is exposed through ctypes. But it is of no help here. A
string is a sequence. As for ensuring box is a color, Pygame can take
care of itself:
>>> import pygame
>>> s = pygame.Surface((10,10), 0, 32)
>>> s.fill("1230")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: invalid color argument
Lenard
Casey Duncan wrote:
I would make the argument that this assertion was broken from the
start. Did pygame ever guarantee that it would be a tuple? Would be
better to check if its a sequence, maybe something like:
try:
tuple(x)
except TypeError:
# Not a sequence
else:
# A sequence
(the biggest problem with the above is that is will think a string is
a sequence in this context)
Kinda makes you wish that PySequence_Check was exposed in python
somehow. Ironically googling for "PySequence_Check" brings up such a
discussion as the first hit.
-Casey
On Aug 14, 2008, at 5:49 PM, René Dudfield wrote:
ah, bugger.
I don't think we can fix this error in pygame.
As the code was using:
if type(x) == tuple:
Unfortunately we can't make the Color type a tuple type.
This is annoying, because pgu is used by a lot of games. So the Color
changes in pygame 1.8.1 will break a lot of things. Well, they'll
need to patch pgu.