summaryrefslogtreecommitdiff
path: root/weave/examples/functional.py
diff options
context:
space:
mode:
authorEric Jones <eric@enthought.com>2002-07-17 06:14:06 +0000
committerEric Jones <eric@enthought.com>2002-07-17 06:14:06 +0000
commitc74893465cedbbab2a8d665990364c4ee71a0ea9 (patch)
tree663cb8c67d4696bb69b699384e216a4cdc47cfad /weave/examples/functional.py
parente6e01392d8b4c678c0e7165626b002055e2f987f (diff)
downloadnumpy-c74893465cedbbab2a8d665990364c4ee71a0ea9.tar.gz
Fixed INCREF bug reported by Matthias Heller that was causing this example to crash.
Diffstat (limited to 'weave/examples/functional.py')
-rw-r--r--weave/examples/functional.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/weave/examples/functional.py b/weave/examples/functional.py
index cd907aec4..1be8065e1 100644
--- a/weave/examples/functional.py
+++ b/weave/examples/functional.py
@@ -36,6 +36,7 @@ def c_list_map2(func,seq):
for(int i = 0; i < seq.length();i++)
{
item = PyList_GET_ITEM(seq.ptr(),i);
+ Py_INCREF(item);
PyTuple_SetItem(args.ptr(),0,item);
this_result = PyEval_CallObject(func,args.ptr());
PyList_SetItem(result.ptr(),i,this_result);
@@ -67,7 +68,7 @@ def time_it(m,n):
result = c_list_map(len,seq)
t2 = time.time()
c = t2-t1
- print 'c speed:', c
+ print 'CXX speed:', c
print 'speed up:', py / c
#load cache