Any advice as to where I should look at and/or how to try fixing this? ~/python/CVS> ./python Lib/test/test_array.py **************************************** array after append: array('c', 'c') char array with 10 bytes of TESTFN appended: array('c', 'cThe quick ') char array with list appended: array('c', 'cThe quick abc') array of c after inserting another: array('c', 'ccThe quick abc') array of c converted to a list: ['c', 'c', 'T', 'h', 'e', ' ', 'q', 'u', 'i', 'c', 'k', ' ', 'a', 'b', 'c'] array of c converted to a string: 'ccThe quick abc' **************************************** array after append: array('b', [1]) array of b after inserting another: array('b', [1, 1]) array of b converted to a list: [1, 1] array of b converted to a string: '\001\001' overflow test: array('b', [-128L]) Traceback (most recent call last): File "Lib/test/test_array.py", line 137, in ? main() File "Lib/test/test_array.py", line 13, in main testtype(type, 1) File "Lib/test/test_array.py", line 132, in testtype testoverflow(type, signedLowerLimit, signedUpperLimit) File "Lib/test/test_array.py", line 25, in testoverflow raise TestFailed, "array(%s) overflowed assigning %s" %\ test_support -- test failed: array('b') overflowed assigning -128L -- Vladimir MARANGOZOV | Vladimir.Marangozov@inrialpes.fr http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252
Any advice as to where I should look at and/or how to try fixing this?
~/python/CVS> ./python Lib/test/test_array.py **************************************** array after append: array('c', 'c') char array with 10 bytes of TESTFN appended: array('c', 'cThe quick ') char array with list appended: array('c', 'cThe quick abc') array of c after inserting another: array('c', 'ccThe quick abc') array of c converted to a list: ['c', 'c', 'T', 'h', 'e', ' ', 'q', 'u', 'i', 'c', 'k', ' ', 'a', 'b', 'c'] array of c converted to a string: 'ccThe quick abc' **************************************** array after append: array('b', [1]) array of b after inserting another: array('b', [1, 1]) array of b converted to a list: [1, 1] array of b converted to a string: '\001\001' overflow test: array('b', [-128L]) Traceback (most recent call last): File "Lib/test/test_array.py", line 137, in ? main() File "Lib/test/test_array.py", line 13, in main testtype(type, 1) File "Lib/test/test_array.py", line 132, in testtype testoverflow(type, signedLowerLimit, signedUpperLimit) File "Lib/test/test_array.py", line 25, in testoverflow raise TestFailed, "array(%s) overflowed assigning %s" %\ test_support -- test failed: array('b') overflowed assigning -128L
Look at b_setitem() in arraymodule.c. What is CHAR_MIN? Do you perchance have unsigned characters??? If so, let's just replace CHAR_MIN with -128 and CHAR_MAX with 127. --Guido van Rossum (home page: http://www.python.org/~guido/)
Guido van Rossum wrote:
Look at b_setitem() in arraymodule.c.
What is CHAR_MIN?
Do you perchance have unsigned characters???
This answers your question: /usr/include/sys/limits.h:#define CHAR_MIN (0) /usr/include/sys/limits.h:#define SCHAR_MIN (-SCHAR_MAX - 1)
If so, let's just replace CHAR_MIN with -128 and CHAR_MAX with 127.
Yes! I #undef/define'd them like this in arraymodule.c and the test passes. Thanks! -- Vladimir MARANGOZOV | Vladimir.Marangozov@inrialpes.fr http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252
participants (2)
-
Guido van Rossum
-
Vladimir.Marangozov@inrialpes.fr