mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2026-03-13 08:00:02 +08:00
Python 3 fixes. _mysql raises SystemError, segfaults
This commit is contained in:
@@ -14,7 +14,7 @@ MySQLdb.converters module.
|
||||
"""
|
||||
|
||||
__revision__ = """$Revision$"""[11:-2]
|
||||
from release import __version__, version_info, __author__
|
||||
from MySQLdb.release import __version__, version_info, __author__
|
||||
|
||||
import _mysql
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class DatabaseTest(unittest.TestCase):
|
||||
self.connection = db
|
||||
self.cursor = db.cursor()
|
||||
self.BLOBText = ''.join([chr(i) for i in range(256)] * 100);
|
||||
self.BLOBUText = u''.join([unichr(i) for i in range(16384)])
|
||||
self.BLOBUText = ''.join([unichr(i) for i in range(16384)])
|
||||
self.BLOBBinary = self.db_module.Binary(''.join([chr(i) for i in range(256)] * 16))
|
||||
|
||||
leak_test = True
|
||||
@@ -84,15 +84,11 @@ class DatabaseTest(unittest.TestCase):
|
||||
','.join(['%s'] * len(columndefs))))
|
||||
data = [ [ generator(i,j) for j in range(len(columndefs)) ]
|
||||
for i in range(self.rows) ]
|
||||
if self.debug:
|
||||
print data
|
||||
self.cursor.executemany(insert_statement, data)
|
||||
self.connection.commit()
|
||||
# verify
|
||||
self.cursor.execute('select * from %s' % self.table)
|
||||
l = self.cursor.fetchall()
|
||||
if self.debug:
|
||||
print l
|
||||
self.assertEquals(len(l), self.rows)
|
||||
try:
|
||||
for i in range(self.rows):
|
||||
@@ -147,8 +143,6 @@ class DatabaseTest(unittest.TestCase):
|
||||
|
||||
try:
|
||||
self.cursor.execute(insert_statement, (0, '0'*256))
|
||||
except Warning:
|
||||
if self.debug: print self.cursor.messages
|
||||
except self.connection.DataError:
|
||||
pass
|
||||
else:
|
||||
@@ -162,8 +156,6 @@ class DatabaseTest(unittest.TestCase):
|
||||
for j in range(len(columndefs)):
|
||||
data.append(generator(i,j))
|
||||
self.cursor.execute(insert_statement,tuple(data))
|
||||
except Warning:
|
||||
if self.debug: print self.cursor.messages
|
||||
except self.connection.DataError:
|
||||
pass
|
||||
else:
|
||||
@@ -175,8 +167,6 @@ class DatabaseTest(unittest.TestCase):
|
||||
data = [ [ generator(i,j) for j in range(len(columndefs)) ]
|
||||
for i in range(self.rows) ]
|
||||
self.cursor.executemany(insert_statement, data)
|
||||
except Warning:
|
||||
if self.debug: print self.cursor.messages
|
||||
except self.connection.DataError:
|
||||
pass
|
||||
else:
|
||||
|
||||
@@ -77,7 +77,7 @@ class test_MySQLdb(capabilities.DatabaseTest):
|
||||
from MySQLdb.constants import ER
|
||||
try:
|
||||
self.cursor.execute("describe some_non_existent_table");
|
||||
except self.connection.ProgrammingError, msg:
|
||||
except self.connection.ProgrammingError as msg:
|
||||
self.assertTrue(msg[0] == ER.NO_SUCH_TABLE)
|
||||
|
||||
def test_bug_3514287(self):
|
||||
@@ -101,4 +101,3 @@ if __name__ == '__main__':
|
||||
gc.enable()
|
||||
gc.set_debug(gc.DEBUG_LEAK)
|
||||
unittest.main()
|
||||
print '''"Huh-huh, he said 'unit'." -- Butthead'''
|
||||
|
||||
Reference in New Issue
Block a user