11/*
2- * Copyright (c) 2014, 2024 , Oracle and/or its affiliates.
2+ * Copyright (c) 2014, 2025 , Oracle and/or its affiliates.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License, version 2.0, as
@@ -2010,16 +2010,16 @@ MySQL_convert_to_mysql(MySQL *self, PyObject *args)
20102010 // datetime is handled first
20112011 new_value = pytomy_datetime (value );
20122012 }
2013- else if (PyDate_CheckExact (value )) {
2013+ else if (PyDate_Check (value )) {
20142014 new_value = pytomy_date (value );
20152015 }
20162016 else if (PyTime_Check (value )) {
20172017 new_value = pytomy_time (value );
20182018 }
2019- else if (PyDelta_CheckExact (value )) {
2019+ else if (PyDelta_Check (value )) {
20202020 new_value = pytomy_timedelta (value );
20212021 }
2022- else if (strcmp (( value )-> ob_type -> tp_name , "decimal.Decimal" ) == 0 ) {
2022+ else if (is_decimal_instance ( value )) {
20232023 new_value = pytomy_decimal (value );
20242024 }
20252025 else if (self -> converter_str_fallback == Py_True ) {
@@ -2194,7 +2194,7 @@ MySQL_query(MySQL *self, PyObject *args, PyObject *kwds)
21942194 continue ;
21952195 }
21962196 /* DATE */
2197- else if (PyDate_CheckExact (value )) {
2197+ else if (PyDate_Check (value )) {
21982198 MYSQL_TIME * date = & pbind -> buffer .t ;
21992199 date -> year = PyDateTime_GET_YEAR (value );
22002200 date -> month = PyDateTime_GET_MONTH (value );
@@ -2225,7 +2225,7 @@ MySQL_query(MySQL *self, PyObject *args, PyObject *kwds)
22252225 continue ;
22262226 }
22272227 /* datetime.timedelta is TIME */
2228- else if (PyDelta_CheckExact (value )) {
2228+ else if (PyDelta_Check (value )) {
22292229 MYSQL_TIME * time = & pbind -> buffer .t ;
22302230 time -> hour = PyDateTime_TIME_GET_HOUR (value );
22312231 time -> minute = PyDateTime_TIME_GET_MINUTE (value );
@@ -2244,7 +2244,7 @@ MySQL_query(MySQL *self, PyObject *args, PyObject *kwds)
22442244 continue ;
22452245 }
22462246 /* DECIMAL */
2247- else if (strcmp (( value )-> ob_type -> tp_name , "decimal.Decimal" ) == 0 ) {
2247+ else if (is_decimal_instance ( value )) {
22482248 pbind -> str_value = pytomy_decimal (value );
22492249 mbind [i ].buffer_type = MYSQL_TYPE_DECIMAL ;
22502250 }
@@ -3383,7 +3383,7 @@ MySQLPrepStmt_execute(MySQLPrepStmt *self, PyObject *args, PyObject *kwds)
33833383 continue ;
33843384 }
33853385 /* DATE */
3386- else if (PyDate_CheckExact (value )) {
3386+ else if (PyDate_Check (value )) {
33873387 MYSQL_TIME * date = & pbind -> buffer .t ;
33883388 date -> year = PyDateTime_GET_YEAR (value );
33893389 date -> month = PyDateTime_GET_MONTH (value );
@@ -3414,7 +3414,7 @@ MySQLPrepStmt_execute(MySQLPrepStmt *self, PyObject *args, PyObject *kwds)
34143414 continue ;
34153415 }
34163416 /* datetime.timedelta is TIME */
3417- else if (PyDelta_CheckExact (value )) {
3417+ else if (PyDelta_Check (value )) {
34183418 MYSQL_TIME * time = & pbind -> buffer .t ;
34193419 time -> hour = PyDateTime_TIME_GET_HOUR (value );
34203420 time -> minute = PyDateTime_TIME_GET_MINUTE (value );
@@ -3433,7 +3433,7 @@ MySQLPrepStmt_execute(MySQLPrepStmt *self, PyObject *args, PyObject *kwds)
34333433 continue ;
34343434 }
34353435 /* DECIMAL */
3436- else if (strcmp (( value )-> ob_type -> tp_name , "decimal.Decimal" ) == 0 ) {
3436+ else if (is_decimal_instance ( value )) {
34373437 pbind -> str_value = pytomy_decimal (value );
34383438 mbind [i ].buffer_type = MYSQL_TYPE_DECIMAL ;
34393439 }
0 commit comments