Use PyObject_CallObject() instead of _PyObject_CallNoArg()

Also fix type setup in prepare protocols for newer pythons.
This commit is contained in:
Charles Leifer 2022-09-21 08:32:43 -05:00
parent 6b1ceca0ba
commit 1e7c243499
2 changed files with 5 additions and 4 deletions

View file

@ -722,7 +722,7 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_
aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*)); aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));
if (*aggregate_instance == NULL) { if (*aggregate_instance == NULL) {
*aggregate_instance = _PyObject_CallNoArg(aggregate_class); *aggregate_instance = PyObject_CallObject(aggregate_class, NULL);
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
*aggregate_instance = 0; *aggregate_instance = 0;
@ -1172,7 +1172,7 @@ static int _progress_handler(void* user_arg)
PyGILState_STATE gilstate; PyGILState_STATE gilstate;
gilstate = PyGILState_Ensure(); gilstate = PyGILState_Ensure();
ret = _PyObject_CallNoArg((PyObject*)user_arg); ret = PyObject_CallObject((PyObject*)user_arg, NULL);
if (!ret) { if (!ret) {
if (_pysqlite_enable_callback_tracebacks) { if (_pysqlite_enable_callback_tracebacks) {

View file

@ -77,7 +77,8 @@ PyTypeObject pysqlite_PrepareProtocolType= {
extern int pysqlite_prepare_protocol_setup_types(void) extern int pysqlite_prepare_protocol_setup_types(void)
{ {
int rc;
pysqlite_PrepareProtocolType.tp_new = PyType_GenericNew; pysqlite_PrepareProtocolType.tp_new = PyType_GenericNew;
Py_TYPE(&pysqlite_PrepareProtocolType)= &PyType_Type; rc = PyType_Ready(&pysqlite_PrepareProtocolType);
return PyType_Ready(&pysqlite_PrepareProtocolType); return rc;
} }