From 70ca325417f2fdee4fac1da460d8f2c819a284d5 Mon Sep 17 00:00:00 2001
From: Dag Sverre Seljebotn <dagss@student.matnat.uio.no>
Date: Thu, 29 Jan 2009 22:08:18 +0100
Subject: [PATCH] Refnanny fix

---
 Cython/Compiler/Nodes.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py
index 0d6556200..bb08311a7 100644
--- a/Cython/Compiler/Nodes.py
+++ b/Cython/Compiler/Nodes.py
@@ -1068,10 +1068,10 @@ class FuncDefNode(StatNode, BlockNode):
         if acquire_gil:
             code.putln("PyGILState_STATE _save = PyGILState_Ensure();")
         # ----- Automatic lead-ins for certain special functions
-        if is_getbuffer_slot:
-            self.getbuffer_init(code)
         if not lenv.nogil:
             code.put_setup_refcount_context(self.entry.name)
+        if is_getbuffer_slot:
+            self.getbuffer_init(code)
         # ----- Fetch arguments
         self.generate_argument_parsing_code(env, code)
         # If an argument is assigned to in the body, we must 
-- 
2.30.9