Skip to content

Commit 62c8c8c

Browse files
authored
call mysql_library_init in module initialization (#377)
1 parent 8e9d759 commit 62c8c8c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

MySQLdb/_mysql.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2643,6 +2643,15 @@ init_mysql(void)
26432643
{
26442644
PyObject *dict, *module, *emod, *edict;
26452645

2646+
if (mysql_library_init(0, NULL, NULL)) {
2647+
PyErr_SetString(PyExc_ImportError, "_mysql: mysql_library_init failed");
2648+
#ifdef IS_PY3K
2649+
return NULL;
2650+
#else
2651+
return;
2652+
#endif
2653+
}
2654+
26462655
#ifdef IS_PY3K
26472656
if (PyType_Ready(&_mysql_ConnectionObject_Type) < 0)
26482657
return NULL;

0 commit comments

Comments
 (0)