Re: [Cython] Cython code producing different, incorrect results under Python 2.7 (not 3.x) under Cython 0.19

2013-04-24 Thread Nikita Nemkin
On Wed, 24 Apr 2013 12:19:36 +0600, Stefan Behnel   
wrote:


The bug is here (at least one of them):
https://github.com/scikit-image/scikit-image/blob/master/skimage/graph/_mcp.pyx#L179
"shape[:-1]" returns incorrect result: input (8, 8), expected output (8,),
actual output ().

I guess that means something is wrong with __Pyx_PyObject_GetSlice utility,
although I wasn't able to create a simple repro yet.


Best regards,
Nikita Nemkin



Hi,

Josh Warner, 24.04.2013 08:06:
Over in scikit-image we have traced an odd problem with a particular  
Cython

file to the 0.19 update of Cython. From at least Cython 0.15.1 (probably
earlier) through 0.18, `_mcp.pyx` in `skimage.graph` compiled and  
executed

correctly, passing all package tests on both Python 2.7 and Python 3.

After 0.19 was released and the Travis builds began using it, we began
getting 100% repeatable errors from the previously clean master branch
(example of an otherwise clean Python
2.7Travis
build; the
Python 3 build  
passedall

tests). All of these errors/failures trace back to this Cython file.
Oddly, the errors only happen on Python 2.7; our Python 3 Travis build
passes.

We are discussing this issue in scikit-image Github Issue
#534;
feel free to join the discussion there.

The .pyx Cython file is located
hereand
it has
an associated .pxd file
here.
It should be noted the file compiles and executes without errors, but  
its

output is now incorrect in Python 2.x.

In case the compiled results might be relevant, for your diffing  
pleasure here

is the compiled .c file from Cython
0.18which
passes all tests on both Python 2.7 and Python 3.x, while here
is the compiled .c file from Cython
0.19which
produces different, incorrect results in Python 2.7.

In the short term we are temporarily forcing Travis to use the 0.18  
release

of Cython, but that isn't a viable long term solution.

It's possible the error is on our end, but seeing as it worked with  
prior

Cython releases we'd appreciate you taking a look.


Thanks for bringing this up. You could make it a little easier for us by
pointing us at the code that produces the incorrect results you are
experiencing. The set of failing tests seems to be quite small, but  
before

we start digging through your code, I'm sure you can provide pointers to
the relevant code snippets for a couple of these tests (i.e. the test  
code
itself and the major code parts that produce the results) much more  
quickly.


Stefan

___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython code producing different, incorrect results under Python 2.7 (not 3.x) under Cython 0.19

2013-04-24 Thread Nikita Nemkin

On Wed, 24 Apr 2013 13:33:46 +0600, Nikita Nemkin  wrote:

Update: this is not a Cython bug.
_mcp.pyx declares #cython: wraparound=False, any negative index is expected
to fail.
It worked previously because Cython was using PySequence_GetSlice
which of course is not sensitive to Cython directives.

The only "fix" would be to produce a warning for constant negative indexes  
in

wraparound=False mode.


Best regards,
Nikita Nemkin


On Wed, 24 Apr 2013 12:19:36 +0600, Stefan Behnel   
wrote:


The bug is here (at least one of them):
https://github.com/scikit-image/scikit-image/blob/master/skimage/graph/_mcp.pyx#L179
"shape[:-1]" returns incorrect result: input (8, 8), expected output  
(8,),

actual output ().

I guess that means something is wrong with __Pyx_PyObject_GetSlice  
utility,

although I wasn't able to create a simple repro yet.


Best regards,
Nikita Nemkin



Hi,

Josh Warner, 24.04.2013 08:06:
Over in scikit-image we have traced an odd problem with a particular  
Cython
file to the 0.19 update of Cython. From at least Cython 0.15.1  
(probably
earlier) through 0.18, `_mcp.pyx` in `skimage.graph` compiled and  
executed

correctly, passing all package tests on both Python 2.7 and Python 3.

After 0.19 was released and the Travis builds began using it, we began
getting 100% repeatable errors from the previously clean master branch
(example of an otherwise clean Python
2.7Travis
build; the
Python 3 build  
passedall

tests). All of these errors/failures trace back to this Cython file.
Oddly, the errors only happen on Python 2.7; our Python 3 Travis build
passes.

We are discussing this issue in scikit-image Github Issue
#534;
feel free to join the discussion there.

The .pyx Cython file is located
hereand
it has
an associated .pxd file
here.
It should be noted the file compiles and executes without errors, but  
its

output is now incorrect in Python 2.x.

In case the compiled results might be relevant, for your diffing  
pleasure here

is the compiled .c file from Cython
0.18which
passes all tests on both Python 2.7 and Python 3.x, while here
is the compiled .c file from Cython
0.19which
produces different, incorrect results in Python 2.7.

In the short term we are temporarily forcing Travis to use the 0.18  
release

of Cython, but that isn't a viable long term solution.

It's possible the error is on our end, but seeing as it worked with  
prior

Cython releases we'd appreciate you taking a look.


Thanks for bringing this up. You could make it a little easier for us by
pointing us at the code that produces the incorrect results you are
experiencing. The set of failing tests seems to be quite small, but  
before

we start digging through your code, I'm sure you can provide pointers to
the relevant code snippets for a couple of these tests (i.e. the test  
code
itself and the major code parts that produce the results) much more  
quickly.


Stefan

___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython code producing different, incorrect results under Python 2.7 (not 3.x) under Cython 0.19

2013-04-24 Thread Josh Warner
Many thanks Nikita, with your advice we've fixed the problem.

Regards,
Josh
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel