From 08fd7fb70fcce28082732c9504f509debff849cf Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Sun, 20 Jul 2008 14:37:04 +0200 Subject: [PATCH] Buffer first assignment refcount optimization --- Cython/Compiler/Buffer.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Cython/Compiler/Buffer.py b/Cython/Compiler/Buffer.py index 97bd6e00..4b1d630e 100644 --- a/Cython/Compiler/Buffer.py +++ b/Cython/Compiler/Buffer.py @@ -205,6 +205,13 @@ class BufferTransform(CythonTransform): u"ACQUIRE": StatListNode(node.pos, stats=acquire_stats), u"BUFINFO": NameNode(pos=node.pos, name=buffer_aux.buffer_info_var.name) }, pos=node.pos) + # Preserve first assignment info on LHS + if node.first: + # TODO: Prettier code + print acq.stats[4].dump() + acq.stats[4].first = True + del acq.stats[0] + del acq.stats[0] # Note: The below should probably be refactored into something # like fragment.substitute(..., context=self.context), with # TreeFragment getting context.pipeline_until_now() and -- 2.26.2