2.4.0 Cygwin - exceptions.OverflowError: can't convert negative value delta.py line 127,

Ronald Blaschke mailing-lists at rblasch.org
Wed Sep 28 19:29:16 UTC 2011


On 09/27/2011 03:02 PM, Martin Packman wrote:
> On 26/09/2011, Ronald Blaschke <mailing-lists at rblasch.org> wrote:
>>
>> Note that it's reporting line 827, which in 2.4.0 says:
>>
>>     aliased[3] = htonl(stat_value.st_dev)
>>
>> Could this be the problem if dev_t is int?
> 
> If you can get cygwin to give you a negative value there that would do
> it too, due to some oddities in how pyrex casts things. When I checked
> cygwin python stat output last night there were some big values for
> st_dev but they were all positive.
> 
> If you run something along these lines, do you get negative values?
> 
>     import os
> 
>     for root, dirs, _ in os.walk("/cygdrive"):
>         for d in dirs:
>             print d, os.stat(os.path.join(root, d)).st_dev
>         break
> 
> You might try the same thing in other locations if your branch is
> somewhere exotic.
> 
> Anyway, if that is the problem, feel free to file a new bug, and I'll
> fix it at the same time as the other variations.

I'm now pretty confident the OverflowError is caused by a negative
stat.st_dev.

On Cygwin, stat.st_dev is actually just the 32-bit "volume serial
number."  I've copied over the whole branch to a temporary disk, set the
volume number to 8000-0000, and got the OverflowError.  With a serial
number of 7fff-ffff, the error went away.

The odd thing is, Python seems to cast the value to an unsigned integer,
because it's always positive there.  In C the value was signed.  Not
sure if Python's positive value is on purpose and guaranteed, or by
accident.

Also, I can't reproduce a build that shows the problem.  I've tried
python-pyrex-0.9.9-2 from the Cygwin repository and Cython 0.15.1, built
myself.  I guess I'm missing something here.

Ron



More information about the bazaar mailing list