Skip to content

Commit f00bc26

Browse files
committed
Fix for CONPY-279:
Allow None values for password and database in change_user() method of connection object.
1 parent 7fe141e commit f00bc26

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

mariadb/mariadb_connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ PyObject *MrdbConnection_change_user(MrdbConnection *self,
624624
int rc= 0;
625625
MARIADB_CHECK_CONNECTION(self, NULL);
626626

627-
if (!PyArg_ParseTuple(args, "sss", &user, &password, &database))
627+
if (!PyArg_ParseTuple(args, "szz", &user, &password, &database))
628628
return NULL;
629629

630630
MARIADB_BEGIN_ALLOW_THREADS(self);

testing/test/integration/test_nondbapi.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ def test_escape(self):
132132
cursor.execute(cmd)
133133
del cursor
134134

135+
def test_conpy279(self):
136+
conn = self.connection
137+
default_conf = conf()
138+
try:
139+
conn.change_user(None, None, None)
140+
except TypeError:
141+
pass
142+
conn.change_user(default_conf["user"], None, None)
143+
conn.close()
144+
135145

136146
if __name__ == '__main__':
137147
unittest.main()

0 commit comments

Comments
 (0)