[pythran] Bizarre problem

  • From: Neal Becker <ndbecker2@xxxxxxxxx>
  • To: "pythran@xxxxxxxxxxxxx" <pythran@xxxxxxxxxxxxx>
  • Date: Wed, 6 Mar 2019 07:15:36 -0500

I am stumped by a bizarre problem.  Referring to
https://gist.github.com/nbecker/16bfba8efce8fed3395682fd4fe0c26d

There is a python function 'try_swap'.  This calls
stuffs = [find_other_set (possible_sets, other_item, limit, dmin) for
other_item in other_items]

There is a python version of 'find_other_set' and a pythran version (note
the pythran code is in the file _minimal_subsets.py, note the '_') imported
as
'find_other_set2'.

If I also call
stuffs2 = [find_other_set2 (possible_sets, other_item, limit, dmin) for
other_item in other_items]

Now it turns out that in all cases stuffs == stuffs2.  Each of these are
elaborate data structures of lists of numpy arrays.
Also if I print these two values to files the files cmp ==.  So it seems
the python version and pythran version of find_other_set produce the same
result.
But if I USE the value stuffs2 the program produces different results than
if I USE the value of stuffs!  (When I say program produces different
results, I mean there is higher level code that calls the function
'try_swap' and eventually it produces a different output).

It does not seem to be a memory corruption issue.  Valgrind shows no
problem.  Results are exactly reproducible, but different between using
'stuffs' and 'stuffs2'.

The only thing I can think of is perhaps there is a difference between the
python code producing a view vs. a copy so perhaps some issue regarding
object identity.

Any ideas?

Other related posts:

  • » [pythran] Bizarre problem - Neal Becker