changeset 29:fbf2470ea3d4 MySQLdb

Remove more pre-2.3 checks and #define work-arounds.
author kylev
date Mon, 09 Feb 2009 01:48:38 +0000
parents 5a3e4cafadec
children e3eb10510ddc
files _mysql_connections.c
diffstat 1 files changed, 22 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/_mysql_connections.c	Sat Feb 07 22:48:05 2009 +0000
+++ b/_mysql_connections.c	Mon Feb 09 01:48:38 2009 +0000
@@ -1,3 +1,5 @@
+/* -*- mode: C; indent-tabs-mode: t; c-basic-offset: 8; -*- */
+
 #include "_mysql.h"
 
 static int
@@ -47,12 +49,11 @@
 					 ))
 		return -1;
 
-	if (!conv) 
+	/* Keep the converter mapping or a blank mapping dict */
+	if (!conv)
 		conv = PyDict_New();
-#if PY_VERSION_HEX > 0x02000100
 	else
 		Py_INCREF(conv);
-#endif
 	if (!conv)
 		return -1;
 	self->converter = conv;
@@ -195,7 +196,6 @@
 	return (PyObject *) c;
 }
 
-#if PY_VERSION_HEX >= 0x02020000
 static int _mysql_ConnectionObject_traverse(
 	_mysql_ConnectionObject *self,
 	visitproc visit,
@@ -205,7 +205,6 @@
 		return visit(self->converter, arg);
 	return 0;
 }
-#endif
 
 static int _mysql_ConnectionObject_clear(
 	_mysql_ConnectionObject *self)
@@ -1415,7 +1414,7 @@
 	PyObject_HEAD_INIT(NULL)
 	0,
 	"_mysql.connection", /* (char *)tp_name For printing */
-	sizeof(_mysql_ConnectionObject),
+	sizeof(_mysql_ConnectionObject), /* tp_basicsize */
 	0,
 	(destructor)_mysql_ConnectionObject_dealloc, /* tp_dealloc */
 	0, /*tp_print*/
@@ -1423,57 +1422,45 @@
 	(setattrfunc)_mysql_ConnectionObject_setattr, /* tp_setattr */
 	0, /*tp_compare*/
 	(reprfunc)_mysql_ConnectionObject_repr, /* tp_repr */
-	
+
 	/* Method suites for standard classes */
-	
+
 	0, /* (PyNumberMethods *) tp_as_number */
 	0, /* (PySequenceMethods *) tp_as_sequence */
 	0, /* (PyMappingMethods *) tp_as_mapping */
-	
+
 	/* More standard operations (here for binary compatibility) */
-	
+
 	0, /* (hashfunc) tp_hash */
 	0, /* (ternaryfunc) tp_call */
 	0, /* (reprfunc) tp_str */
 	0, /* (getattrofunc) tp_getattro */
 	0, /* (setattrofunc) tp_setattro */
-	
+
 	/* Functions to access object as input/output buffer */
 	0, /* (PyBufferProcs *) tp_as_buffer */
-	
+
 	/* Flags to define presence of optional/expanded features */
-#if PY_VERSION_HEX < 0x02020000
-	Py_TPFLAGS_DEFAULT, /* (long) tp_flags */
-#else
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
-#endif
+
 	_mysql_connect__doc__, /* (char *) tp_doc Documentation string */
-#if PY_VERSION_HEX >= 0x02000000	
-	/* Assigned meaning in release 2.0 */
-#if PY_VERSION_HEX >= 0x02020000
+
 	/* call function for all accessible objects */
-	(traverseproc) _mysql_ConnectionObject_traverse, /* tp_traverse */
-	
+	(traverseproc)_mysql_ConnectionObject_traverse, /* tp_traverse */
+
 	/* delete references to contained objects */
-	(inquiry) _mysql_ConnectionObject_clear, /* tp_clear */
-#else
-	/* not supporting pre-2.2 GC */
-	0,
-	0,
-#endif
-#if PY_VERSION_HEX >= 0x02010000	
-	/* Assigned meaning in release 2.1 */
+	(inquiry)_mysql_ConnectionObject_clear, /* tp_clear */
+
 	/* rich comparisons */
 	0, /* (richcmpfunc) tp_richcompare */
-	
+
 	/* weak reference enabler */
 	0, /* (long) tp_weaklistoffset */
-#if PY_VERSION_HEX >= 0x02020000
-	/* Added in release 2.2 */
+
 	/* Iterators */
 	0, /* (getiterfunc) tp_iter */
 	0, /* (iternextfunc) tp_iternext */
-	
+
 	/* Attribute descriptor and subclassing stuff */
 	(struct PyMethodDef *)_mysql_ConnectionObject_methods, /* tp_methods */
 	(MyMemberlist(*))_mysql_ConnectionObject_memberlist, /* tp_members */
@@ -1486,12 +1473,8 @@
 	(initproc)_mysql_ConnectionObject_Initialize, /* tp_init */
 	NULL, /* tp_alloc */
 	NULL, /* tp_new */
-	NULL, /* tp_free Low-level free-memory routine */ 
+	NULL, /* tp_free Low-level free-memory routine */
 	0, /* (PyObject *) tp_bases */
 	0, /* (PyObject *) tp_mro method resolution order */
 	0, /* (PyObject *) tp_defined */
-#endif /* python 2.2 */
-#endif /* python 2.1 */
-#endif /* python 2.0 */
-} ;
-
+};