changeset 69:18e5892a5aed MySQLdb

Defer incrementing reference to the decoder stack until later so we don't have to dec-ref if an error happens. Merge of change 630 on 1.2br.
author kylev
date Fri, 24 Jul 2009 00:27:38 +0000
parents 1e1e24fddc74
children 29b4cfd9af07
files src/connections.c
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/connections.c	Fri Jul 24 00:23:14 2009 +0000
+++ b/src/connections.c	Fri Jul 24 00:27:38 2009 +0000
@@ -49,12 +49,6 @@
 					 ))
 		return -1;
 
-	if (!decoder_stack)
-		decoder_stack = PyList_New(0);
-	else
-		Py_INCREF(decoder_stack);
-	self->decoder_stack = decoder_stack;
-	
 #define _stringsuck(d,t,s) {t=PyMapping_GetItemString(s,#d);\
         if(t){d=PyString_AsString(t);Py_DECREF(t);}\
         PyErr_Clear();}
@@ -112,6 +106,13 @@
 		_mysql_Exception(self);
 		return -1;
 	}
+
+	if (!decoder_stack)
+		decoder_stack = PyList_New(0);
+	else
+		Py_INCREF(decoder_stack);
+	self->decoder_stack = decoder_stack;
+
 	/*
 	  PyType_GenericAlloc() automatically sets up GC allocation and
 	  tracking for GC objects, at least in 2.2.1, so it does not need to