Robert Bradshaw, 31.07.2012 19:24:
> On Tue, Jul 31, 2012 at 7:24 AM, Stefan Behnel wrote:
>> mark florisson, 28.07.2012 14:04:
>>> On 27 July 2012 23:30, Bradley Froehle wrote:
>>>> Thanks to the work of Yaroslav Halchenko, there is an experimental Debian
>>>> package for Cython 0.17.beta1 -- 
>>>> http://packages.qa.debian.org/c/cython.html
>>>>
>>>> However, the builds are showing a lot of test failures on non-amd64 sytems.
>>>> See 
>>>> https://buildd.debian.org/status/package.php?p=cython&suite=experimental
>>>> Many of the errors seem related to assumptions made about the sizes of
>>>> various integers (int vs. long vs long long).  Ideally we'll be able to
>>>> clean up these failures before the final release.
>>>
>>> Thanks, I think it's mostly the tests that are wrong. I'll try to get
>>> it fixed on linux 32 bit.
>>
>> I'm not sure the it's only the tests. The "char" vs. "unsigned char" errors
>> hint at platform specific differences, which might trigger bugs (aka.
>> incorrect assumptions) in the generated memory view code. Specifically,
>> plain "char" is unsigned at least on ARM and PowerPC, both of which fail
>> with this error.
> 
> Yes, I think somewhere we're assuming char is signed, but wasn't able
> to see where in my quick investigations.

Yes, it wasn't immediately obvious to me either. Here is a patch that
*might* fix the issue - obviously untested for the platforms in question.

Yaroslav, could you give it a try on the Debian build servers?

Stefan

diff -r 0d14a856f2cd Cython/Compiler/Buffer.py
--- a/Cython/Compiler/Buffer.py	Tue Jul 31 20:05:37 2012 +0200
+++ b/Cython/Compiler/Buffer.py	Tue Jul 31 21:10:13 2012 +0200
@@ -680,32 +680,25 @@
         rep = str(dtype)
 
         flags = "0"
-
+        is_unsigned = "0"
         if dtype.is_int:
-            if dtype.signed == 0:
-                typegroup = 'U'
-            else:
-                typegroup = 'I'
+            is_unsigned = "IS_UNSIGNED(%s)" % declcode
+            typegroup = "%s ? 'U' : 'I'" % is_unsigned
         elif complex_possible or dtype.is_complex:
-            typegroup = 'C'
+            typegroup = "'C'"
         elif dtype.is_float:
-            typegroup = 'R'
+            typegroup = "'R'"
         elif dtype.is_struct:
-            typegroup = 'S'
+            typegroup = "'S'"
             if dtype.packed:
                 flags = "__PYX_BUF_FLAGS_PACKED_STRUCT"
         elif dtype.is_pyobject:
-            typegroup = 'O'
+            typegroup = "'O'"
         else:
             assert False
 
-        if dtype.is_int:
-            is_unsigned = "IS_UNSIGNED(%s)" % declcode
-        else:
-            is_unsigned = "0"
-
         typeinfo = ('static __Pyx_TypeInfo %s = '
-                        '{ "%s", %s, sizeof(%s), { %s }, %s, \'%s\', %s, %s };')
+                        '{ "%s", %s, sizeof(%s), { %s }, %s, %s, %s, %s };')
         tup = (name, rep, structinfo_name, declcode,
                ', '.join([str(x) for x in arraysizes]) or '0', len(arraysizes),
                typegroup, is_unsigned, flags)
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to