Ok, great. color_test.py passes for me. FYI, Python 2.x ints are C
longs, whatever size that may be on a particular machine.
Lenard
Tyler Laing wrote:
Lenard,
Thanks a lot! :) I incorporated your fix into the baseline code, and
there just needed to be some slight modifications for the other
Lenard,
Thanks a lot! :) I incorporated your fix into the baseline code, and there
just needed to be some slight modifications for the other conversion
functions, long, int, float, in addition to float and oct. I had initially
considered LONG_MAX, but I wasn't sure what it would do, and didn't kno
Hi,
Yes, I was using the second patch which only modifies color.c. However
the 'L's are necessary on 32 bit machines since 0xCC00CC00 can only be
represented as a Python long. So try this patch. It keeps the "L"s but
replaces INT_MAX with LONG_MAX, which is the proper test for a Python
int (*
Are you using the second patch I provided? I had to make some modifications
initially to the color_test.py, which I had a feeling would break on 32 bit
machines. The second patch avoids modifying color_test.py, and instead does
not cast the results from hex and oct as longs, which was adding a 'L'
Hi Tyler,
This patch breaks things for 32bit machines. Give me a few minutes and I
will see if I can cook something up.
Lenard
Tyler Laing wrote:
Rene,
Oops, about the windows line ends. I'll make sure that doesn't happen
again. Sorry about that. I do have SVN write access now, I just wan
Rene,
Oops, about the windows line ends. I'll make sure that doesn't happen again.
Sorry about that. I do have SVN write access now, I just wanted to start
with the patch first.
I honestly don't know much about pygame.color, so I can't help there.
However, if we never want to return a long, then
Cool, thanks.
I think we can look applying this patch after Lenard has merged his
py3k stuff back in... so we don't get any many conflicts. As I
noticed he's already touched the color.c.
We shouldn't ever be returning a long I don't think. So perhaps we
can do a conversion from python long to p
Correction, you have to do this: unsigned long tmp = ((long)color->r << 24)
+ ((long)color->g << 16) + ((long)color->b << 8) +... to be specific.
-Tyler
On Fri, May 1, 2009 at 6:21 PM, Tyler Laing wrote:
> Rene,
>
> Okay, so I've got a fix. You have to prefix color->r with (long), and then
> fo
Hi,
cool, nice one.
make your change to the file/files, make sure it compiles and passes
the tests...
Then run: svn diff > patch.diff
Then send the patch to the mailing list... or upload it somewhere, and
send a link to it if it's really big... or just paste it into the
email if it's tiny.
cu
Rene,
Okay, so I've got a fix. You have to prefix color->r with (long), and then
for hex and oct functions, you need to change INT_MAX to LONG_MAX for a 64
bit platform.
How do I make a patch for submission?
-Tyler
On Fri, May 1, 2009 at 5:33 PM, Tyler Laing wrote:
> Rene,
>
> You are right.
Rene,
You are right. I isolated the specific issue, and here's a sample .c file
that shows the error on the 64 bit platform. When I get something that works
on the the test file, I'll try it on the actual pygame code and see how the
test performs.
-Tyler
On Fri, May 1, 2009 at 4:30 PM, Tyler Lai
I'll try that then. For reference, I am using an AMD Athlon 64 X2 5200+
processor. What would be the proper way to make it endian safe?
Change the unsigned long tmp to unsigned int tmp?
-Tyler
On Fri, May 1, 2009 at 4:24 PM, René Dudfield wrote:
> hi,
>
> there's some parts like this...
>
> st
hi,
there's some parts like this...
static PyObject*
_color_float (PyColor *color)
{
unsigned long tmp = (color->r << 24) + (color->g << 16) + (color->b << 8) +
color->a;
return PyFloat_FromDouble ((double) tmp);
}
this code isn't endian or 64bit safe... since it is using bit shi
Taking a look at color.c, I believe the bug may actually rest in the
Py_FromUnsignedLong/Py_FromDouble/Py_FromString functions
provided by the Python libs. There is no logical or numerical reason why,
from the numbers we have, we would get those values with those operations.
The tests beforehand af
hi,
Below are the failing unittests for Color on 64bit ubuntu.
==
> FAIL: ColorTypeTest.test_float
> --
> Traceback (most recent call last):
> File "/usr/li
15 matches
Mail list logo