From: Dag Sverre Seljebotn Date: Fri, 1 Aug 2008 22:01:53 +0000 (+0200) Subject: More variable used problems in buffers fixed X-Git-Tag: 0.9.8.1~49^2~36 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9615ebdd89b5eed8e8923e5278d59d7e53e2fdf0;p=cython.git More variable used problems in buffers fixed --- diff --git a/Cython/Compiler/Buffer.py b/Cython/Compiler/Buffer.py index b77b594d..4e9df459 100644 --- a/Cython/Compiler/Buffer.py +++ b/Cython/Compiler/Buffer.py @@ -119,7 +119,8 @@ def used_buffer_aux_vars(entry): buffer_aux.buffer_info_var.used = True for s in buffer_aux.shapevars: s.used = True for s in buffer_aux.stridevars: s.used = True - for s in buffer_aux.suboffsetvars: s.used = True + if buffer_aux.suboffsetvars: + for s in buffer_aux.suboffsetvars: s.used = True def put_unpack_buffer_aux_into_scope(buffer_aux, mode, code): # Generate code to copy the needed struct info into local diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 6fb5744d..db2e323b 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -885,9 +885,6 @@ class NameNode(AtomicExprNode): self.type = PyrexTypes.error_type self.entry.used = 1 if self.entry.type.is_buffer: - # Have an rhs temp just in case. All rhs I could - # think of had a single symbol result_code but better - # safe than sorry. Feel free to change this. import Buffer Buffer.used_buffer_aux_vars(self.entry) @@ -964,6 +961,9 @@ class NameNode(AtomicExprNode): entry = self.entry if entry: entry.used = 1 + if entry.type.is_buffer: + import Buffer + Buffer.used_buffer_aux_vars(entry) if entry.utility_code: env.use_utility_code(entry.utility_code) diff --git a/tests/run/bufaccess.pyx b/tests/run/bufaccess.pyx index d61ae74f..a40a937f 100644 --- a/tests/run/bufaccess.pyx +++ b/tests/run/bufaccess.pyx @@ -34,14 +34,18 @@ def testcas(a): # Buffer acquire and release tests # -@testcase def nousage(): """ - >>> True - True + The challenge here is just compilation. + """ + cdef object[int, 2] buf + +def printbuf(): + """ + Just compilation. """ cdef object[int, 2] buf - # this used not to compile + print buf @testcase def acquire_release(o1, o2):