Skip to content

Commit 84967a9

Browse files
committed
Follow up for fix of CONPY-244:
Raise a warning instead an exception.
1 parent 5ce5ca3 commit 84967a9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

mariadb/mariadb_connection.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,10 @@ MrdbConnection_Initialize(MrdbConnection *self,
328328

329329
#if MARIADB_PACKAGE_VERSION_ID < 30302
330330
if (status_callback)
331-
{
332-
mariadb_throw_exception(NULL, Mariadb_OperationalError, 1,
333-
"Use of status_callback requires Connector/C version 3.3.2 or higher.");
334-
return -1;
331+
{
332+
/* status callback requires C/C 3.3.2 */
333+
PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "status_callback support requires MariaDB Connector/C >= 3.3.2 "\
334+
"(found version %s)", mysql_get_client_info());
335335
}
336336
#else
337337
self->status_callback= status_callback;
@@ -346,7 +346,13 @@ MrdbConnection_Initialize(MrdbConnection *self,
346346

347347
#if MARIADB_PACKAGE_VERSION_ID > 30301
348348
if (mysql_optionsv(self->mysql, MARIADB_OPT_STATUS_CALLBACK, MrdbConnection_process_status_info, self))
349-
goto end;
349+
{
350+
/* Generate a warning, not an error - this will allow to run the module if Connector/C installation
351+
was overwritten */
352+
PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "MariaDB Connector/Python was build with MariaDB Connector/C version %s "\
353+
"but loaded Connector/C library has version %s", MARIADB_PACKAGE_VERSION,
354+
mysql_get_client_info());
355+
}
350356
#endif
351357

352358
MARIADB_BEGIN_ALLOW_THREADS(self);

0 commit comments

Comments
 (0)