Skip to content

Commit 57b8a60

Browse files
authored
Replace deprecated PyUnicode_GET_DATA_SIZE so it builds with 3.13
PyUnicode_GET_DATA_SIZE is no longer there. Replaced with PyUnicode_GET_LENGTH Even if this return the size on codepoints rather than bytes, we use '* sizeof(SQLWCHAR)' for the mem allocation.
1 parent f8c8b6c commit 57b8a60

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

IfxPy/ifxpyc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ static PyObject *_python_IfxPy_register_smart_trigger_helper(PyObject *self, PyO
986986
return NULL;
987987
}
988988

989-
objectSize = PyUnicode_GET_DATA_SIZE(tableNameObj);
989+
objectSize = PyUnicode_GET_LENGTH(tableNameObj);
990990
tableName = (SQLWCHAR *)malloc((int)objectSize*sizeof(SQLWCHAR) + sizeof(SQLWCHAR));
991991
if (tableName == NULL)
992992
{
@@ -1011,7 +1011,7 @@ static PyObject *_python_IfxPy_register_smart_trigger_helper(PyObject *self, PyO
10111011
PyErr_SetString(PyExc_Exception, "statement must be a string or unicode");
10121012
return NULL;
10131013
}
1014-
objectSize = PyUnicode_GET_DATA_SIZE(ownerNameObj);
1014+
objectSize = PyUnicode_GET_LENGTH(ownerNameObj);
10151015
ownerName = (SQLWCHAR *)malloc((int)objectSize * sizeof(SQLWCHAR) + sizeof(SQLWCHAR));
10161016
if (ownerName == NULL)
10171017
{
@@ -1036,7 +1036,7 @@ static PyObject *_python_IfxPy_register_smart_trigger_helper(PyObject *self, PyO
10361036
PyErr_SetString(PyExc_Exception, "statement must be a string or unicode");
10371037
return NULL;
10381038
}
1039-
objectSize = PyUnicode_GET_DATA_SIZE(dbNameObj);
1039+
objectSize = PyUnicode_GET_LENGTH(dbNameObj);
10401040
dbName = (SQLWCHAR *)malloc((int)objectSize * sizeof(SQLWCHAR) + sizeof(SQLWCHAR));
10411041
if (dbName == NULL)
10421042
{
@@ -1061,7 +1061,7 @@ static PyObject *_python_IfxPy_register_smart_trigger_helper(PyObject *self, PyO
10611061
PyErr_SetString(PyExc_Exception, "statement must be a string or unicode");
10621062
return NULL;
10631063
}
1064-
objectSize = PyUnicode_GET_DATA_SIZE(sqlQueryObj);
1064+
objectSize = PyUnicode_GET_LENGTH(sqlQueryObj);
10651065
sqlQuery = (SQLWCHAR *)malloc((int)objectSize * sizeof(SQLWCHAR) + sizeof(SQLWCHAR));
10661066
if (sqlQuery == NULL)
10671067
{
@@ -1086,7 +1086,7 @@ static PyObject *_python_IfxPy_register_smart_trigger_helper(PyObject *self, PyO
10861086
PyErr_SetString(PyExc_Exception, "Statement must be a string or unicode");
10871087
return NULL;
10881088
}
1089-
objectSize = PyUnicode_GET_DATA_SIZE(labelObj);
1089+
objectSize = PyUnicode_GET_LENGTH(labelObj);
10901090
label = (SQLWCHAR *)malloc((int)objectSize * sizeof(SQLWCHAR) + sizeof(SQLWCHAR));
10911091
if (label == NULL)
10921092
{

0 commit comments

Comments
 (0)