On Mon, Sep 19, 2011 at 9:08 PM, Yaroslav Halchenko <li...@onerussian.com> wrote: > is this regression or am I missing cython basics (which wouldn't be > surprising). > > while testing 0.15.1 on Debian I have ran into fail-to-build-from-source > for dipy package in Debian, failure due to error while running tests: > > DM2 = pf.bundles_distances_mam(tracksA, tracksB, metric=metric) > File "distances.pyx", line 504, in > dipy.tracking.distances.bundles_distances_mam (dipy/tracking/distances.c:5710) > UnboundLocalError: local variable 'longest_track_lenA' referenced before > assignment > > > which worked fine with previous cython and looking at the dipy's .pyx > code it seems to be ok (just an untyped cdef... no errors during 'compiling'): > > def bundles_distances_mam(tracksA, tracksB, metric='avg'): > .... > # preprocess tracks > cdef: > size_t longest_track_len = 0, track_len > longest_track_lenA, longest_track_lenB > cnp.ndarray[object, ndim=1] tracksA32 > ... > # some code ... cut .... > if track_len > longest_track_lenA: > longest_track_lenA = track_len
See the "Incompatible changes" section of http://wiki.cython.org/ReleaseNotes-0.15 . This change was made to be more compatible with Python semantics. Set this variable to None if you want to use it before you assign it to something else. (Looking at the code, it should probably be 0 or something else, and these variables could be typed as size_t.) - Robert _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel