diff options
author | Mark Florisson <markflorisson88@gmail.com> | 2012-04-10 15:01:00 +0100 |
---|---|---|
committer | Mark Florisson <markflorisson88@gmail.com> | 2012-04-10 15:01:00 +0100 |
commit | d96dfdbb290d23bf3b4a186dc5b1b5d9ee7fcaa5 (patch) | |
tree | e4e3484eda118991e05c45c5e65ac065987f83ff /Cython/Compiler/MemoryView.py | |
parent | 703dd88684f52aab4f0f25e550e39657ce6c43bf (diff) | |
download | cython-d96dfdbb290d23bf3b4a186dc5b1b5d9ee7fcaa5.tar.gz |
Decref memoryview slice class attributes
Diffstat (limited to 'Cython/Compiler/MemoryView.py')
-rw-r--r-- | Cython/Compiler/MemoryView.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/Cython/Compiler/MemoryView.py b/Cython/Compiler/MemoryView.py index 8e7121973..1f994cfae 100644 --- a/Cython/Compiler/MemoryView.py +++ b/Cython/Compiler/MemoryView.py @@ -86,7 +86,7 @@ def put_acquire_memoryviewslice(lhs_cname, lhs_type, lhs_pos, rhs, code, "We can avoid decreffing the lhs if we know it is the first assignment" assert rhs.type.is_memoryviewslice - pretty_rhs = isinstance(rhs, NameNode) or rhs.result_in_temp() + pretty_rhs = rhs.result_in_temp() or rhs.is_simple() if pretty_rhs: rhstmp = rhs.result() else: @@ -106,19 +106,11 @@ def put_assign_to_memviewslice(lhs_cname, rhs, rhs_cname, memviewslicetype, code if not first_assignment: code.put_xdecref_memoryviewslice(lhs_cname, have_gil=have_gil) - if rhs.is_name: - code.put_incref_memoryviewslice(rhs_cname, have_gil=have_gil) + if not rhs.result_in_temp(): + rhs.make_owned_memoryviewslice(code) code.putln("%s = %s;" % (lhs_cname, rhs_cname)) - #code.putln("%s.memview = %s.memview;" % (lhs_cname, rhs_cname)) - #code.putln("%s.data = %s.data;" % (lhs_cname, rhs_cname)) - #for i in range(memviewslicetype.ndim): - # tup = (lhs_cname, i, rhs_cname, i) - # code.putln("%s.shape[%d] = %s.shape[%d];" % tup) - # code.putln("%s.strides[%d] = %s.strides[%d];" % tup) - # code.putln("%s.suboffsets[%d] = %s.suboffsets[%d];" % tup) - def get_buf_flags(specs): is_c_contig, is_f_contig = is_cf_contig(specs) |