diff --git a/MySQLdb/CHANGELOG b/MySQLdb/CHANGELOG index 2249016..4484020 100644 --- a/MySQLdb/CHANGELOG +++ b/MySQLdb/CHANGELOG @@ -1,3 +1,29 @@ +0.9.2c3 + + * Did some more setup cleanups. Apparently on non-server versions of + MacOSX, the MySQL stuff installs in /sw instead of /usr/local. + + * There's now a cursor._execute(), used by execute() and executemany(), + when does NOT clear cursor.messages. Internal use only. This is so + all messages can be kept with executemany(). + + * Fixed a memory leak (cursor+traceback) I introduced when reworking + the errorhandler code. + + * If both conv and unicode options were given to connect, things + broke. (Skip Montanaro) + + * Since MySQL uses the same internal FIELD_TYPE for both BLOB and + TEXT columns, reverting the 0.9.2c1 change that returned them + as array objects; they are now strings again. Array objects passed + as parameters are still converted correctly into string literals. + + * Replaced cursor iterator implementation with something not dumb. + The old one worked, but the new one makes use of the iter() + function. StoreResultMixIn has it's own implementation which is + fast but doesn't update the rownumber, which should not be a real + problem in practice. + 0.9.2c2 * errorhandler cleanups (Rob Steele) @@ -15,6 +41,7 @@ * BLOBs are now converted to Python array objects (from the array module). If you are expecting them to be strings, sorry. This is actually the preferred representation for DB-API. + [Reverted in 0.9.2c3] * MySQL converts array objects passed as parameters into a correct string representation (presumably for BLOB columns). diff --git a/MySQLdb/MySQLdb/__init__.py b/MySQLdb/MySQLdb/__init__.py index dbfd26a..8f68bfb 100644 --- a/MySQLdb/MySQLdb/__init__.py +++ b/MySQLdb/MySQLdb/__init__.py @@ -20,7 +20,7 @@ version_info = ( 9, 2, "gamma", - 2) + 3) if version_info[3] == "final": __version__ = "%d.%d.%d" % version_info[:3] else: __version__ = "%d.%d.%d%1.1s%d" % version_info[:5] @@ -37,9 +37,9 @@ apilevel = "2.0" paramstyle = "format" from _mysql import * -from sets import DBAPISet, Set -from constants import FIELD_TYPE -from times import Date, Time, Timestamp, \ +from MySQLdb.sets import DBAPISet, Set +from MySQLdb.constants import FIELD_TYPE +from MySQLdb.times import Date, Time, Timestamp, \ DateFromTicks, TimeFromTicks, TimestampFromTicks diff --git a/MySQLdb/MySQLdb/cursors.py b/MySQLdb/MySQLdb/cursors.py index 8970f3c..6bc4790 100644 --- a/MySQLdb/MySQLdb/cursors.py +++ b/MySQLdb/MySQLdb/cursors.py @@ -91,9 +91,12 @@ class BaseCursor: Returns long integer rows affected, if any """ + del self.messages[:] + return self._execute(query, args) + + def _execute(self, query, args): from types import ListType, TupleType from sys import exc_info - del self.messages[:] try: r = self._query(query % self.connection.literal(args)) except TypeError, m: @@ -103,8 +106,9 @@ class BaseCursor: else: self.errorhandler(self, TypeError, m) except: - e = exc_info() - self.errorhandler(self, e[0], e[1]) + exc, value, tb = exc_info() + del tb + self.errorhandler(self, exc, value) self._executed = query return r @@ -134,7 +138,7 @@ class BaseCursor: if not m: r = 0 for a in args: - r = r + self.execute(query, a) + r = r + self._execute(query, a) return r p = m.start(1) qv = query[p:] @@ -149,8 +153,9 @@ class BaseCursor: else: self.errorhandler(self, TypeError, msg) except: - e = exc_info() - self.errorhandler(self, e[0], e[1]) + exc, value, tb = exc_info() + del tb + self.errorhandler(self, exc, value) r = self._query(join(q,',\n')) self._executed = query return r diff --git a/MySQLdb/_mysql.c b/MySQLdb/_mysql.c index 4614057..ba49d43 100644 --- a/MySQLdb/_mysql.c +++ b/MySQLdb/_mysql.c @@ -1,4 +1,4 @@ -#define version_info "(0,9,2,'gamma',2)" +#define version_info "(0,9,2,'gamma',3)" #define __version__ "0.9.2" /* This program is free software; you can redistribute it and/or modify @@ -2135,7 +2135,8 @@ DL_EXPORT(void) init_mysql(void) { PyObject *dict, *module, *emod, *edict; - module = Py_InitModule3("_mysql", _mysql_methods, _mysql___doc__); + module = Py_InitModule4("_mysql", _mysql_methods, _mysql___doc__, + (PyObject *)NULL, PYTHON_API_VERSION); #ifdef MS_WIN32 _mysql_ConnectionObject_Type.ob_type = &PyType_Type; _mysql_ResultObject_Type.ob_type = &PyType_Type; diff --git a/MySQLdb/setup.py b/MySQLdb/setup.py index f5ffa47..7f599c2 100644 --- a/MySQLdb/setup.py +++ b/MySQLdb/setup.py @@ -18,7 +18,7 @@ thread_safe_library = YES # forget to include the value of sys.platform and os.name. name = "MySQL-%s" % os.path.basename(sys.executable) -version = "0.9.2c2" +version = "0.9.2c3" mysqlclient = thread_safe_library and "mysqlclient_r" or "mysqlclient" @@ -56,8 +56,8 @@ elif sys.platform in ("freebsd4", "openbsd3"): include_dirs = ['%s/include/mysql' % LOCALBASE] library_dirs = ['%s/lib/mysql' % LOCALBASE] elif sys.platform == "sunos5": # Solaris 2.8 + gcc - runtime_library_dirs = ['/usr/local/lib:/usr/openwin/lib:/usr/dt/lib'] - extra_compile_args = ["-fPIC"] + runtime_library_dirs.append('/usr/local/lib:/usr/openwin/lib:/usr/dt/lib') + extra_compile_args.append("-fPIC") elif sys.platform == "win32": # Ugh include_dirs = [r'c:\mysql\include'] library_dirs = [r'c:\mysql\lib\opt'] @@ -67,9 +67,11 @@ elif sys.platform == "win32": # Ugh elif sys.platform == "cygwin": include_dirs = ['/c/mysql/include'] library_dirs = ['/c/mysql/lib'] - extra_compile_args = ['-DMS_WIN32'] + extra_compile_args.append('-DMS_WIN32') elif sys.platform[:6] == "darwin": # Mac OS X - extra_link_args = ['-flat_namespace'] + include_dirs.append('/sw/include') + library_dirs.append('/sw/lib') + extra_link_args.append('-flat_namespace') elif sys.platform == 'linux2' and os.environ.get('HOSTTYPE') == 'alpha': libraries.extend(['ots', 'cpml']) elif os.name == "posix": # UNIX-ish platforms not covered above