Python: Odd "pnc=: N" error message
<p>I was running my Python <a href="http://en.wikipedia.org/wiki/Longest_common_subsequence_problem" rel="nofollow">longest common subsequence</a> algorithm on an especially largely input set, storing the resulting LCS lengths in a two-dimensional numpy array. I noticed it was slowing down over time; around a third of the way through, it slowed to a crawl, then crashed, printing the enigmatic error message "pnc=: N", with no newline afterward (my program printed one more line of output before stopping). It also appeared to release a good deal of allocated memory at this point. Does anyone have any idea what this means?</p>

<p>EDIT: The part of the code that crashed is:</p>

<pre><code>#m and n are both around 12,000
lengths = np.empty((m+1, n+1), dtype=np.uint)
lengths[0,:] = 0
lengths[1:,0] = 0

if m &gt; 0 and n &gt; 0:
    for i in xrange(1, m + 1):
        for j in xrange(1, n + 1):
            #eqTest is a function comparing two sequence elements, like cmp
            eq = eqTest(a[i-1], b[j-1])
            if eq:
                lengths[i,j] = lengths[i-1,j-1] + 1
            elif lengths[i-1,j] &gt;= lengths[i,j-1]:
                lengths[i,j] = lengths[i-1,j]
            else:
                lengths[i,j] = lengths[i,j-1]
</code></pre>

<p>I'm not sure what caused it to slow down or use more resources over time, since the entire LCS length array is allocated at the beginning and then populated. The equality test I'm using is hard to describe as it's partly written in C, but it's effectively:</p>

<pre><code>def eqTest(l1, l2):
    words1 = l1.split()
    words2 = l2.split()
    if len(words1) == len(words2):
        for i in xrange(len(words1)):
            #MATCHERS is a list of around 10 compiled regular expressions
            for m in MATCHERS:
                if m.match(s1) is not None and m.match(s2) is not None:
                    break
            else:
                result = False
                break
        else:
            result = True
    else:
        result = False
return result
</code></pre>
