Closed robertwb closed 7 years ago
Modified by nikratio on 2 Feb 2016 17:13 UTC
Comment by nikratio on 16 Feb 2016 20:29 UTC I believe this is just precedence gone wrong, the generated code should be:
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) -digits[0])
Otherwise the minus promotes to integer after the cast to sdigit.
Comment by nikratio on 16 Feb 2016 20:33 UTC ...and here's a patch against git head. Thanks to Christian Neukirchen for investigating!
diff --git a/Cython/Utility/TypeConversion.c b/Cython/Utility/TypeConversion.c
--- a/Cython/Utility/TypeConversion.c
+++ b/Cython/Utility/TypeConversion.c
@@ -685,7 +685,7 @@
const digit* digits = ((PyLongObject*)x)->ob_digit;
switch (Py_SIZE(x)) {
case 0: return ({{TYPE}}) 0;
- case -1: __PYX_VERIFY_RETURN_INT({{TYPE}}, sdigit, -(sdigit) digits[ case -1: __PYX_VERIFY_RETURN_INT({{TYPE}}, sdigit, (sdigit) -digits[0](0])
+))
case 1: __PYX_VERIFY_RETURN_INT({{TYPE}}, digit, +digits[0])
{{for _size in (2, 3, 4)}}
Modified by nikratio on 16 Feb 2016 20:33 UTC
Modified by scoder on 24 Mar 2016 17:51 UTC
Modified by scoder on 24 Mar 2016 17:51 UTC
Reported by nikratio on 1 Feb 2016 17:14 UTC It seems
__PYX_VERIFY_RETURN_INT
may fail on 32 bit systems, it produces a conversion warning:I don't have a 32-bit system myself, this was originally reported at https://bitbucket.org/nikratio/python-llfuse/issues/76.
The Cython generated code and the .pyx source can be downloaded from https://bitbucket.org/nikratio/python-llfuse/downloads. The C code in the tarball was generated with Cython 0.24.0a0 (from Git).
Migrated-From: http://trac.cython.org/ticket/877