Merge pull request #2077 from swt2c/deprecated_c_api

Fix some compiler warnings
This commit is contained in:
Scott Talbert
2022-01-24 19:57:13 -05:00
committed by GitHub
6 changed files with 13 additions and 9 deletions

View File

@@ -82,7 +82,7 @@ def run():
PyObject* args = Py_BuildValue("(LL)", item1, item2);
#endif
PyObject* result = PyEval_CallObject(func, args);
PyObject* result = PyObject_CallObject(func, args);
Py_DECREF(args);
if (result) {
retval = wxPyInt_AsLong(result);

View File

@@ -87,6 +87,8 @@ def parseAndTweakModule():
body="""\
#ifdef __WXMSW__
return self->ShowNativeCaret(show);
#else
return false;
#endif
""")
c.addCppMethod('bool', 'HideNativeCaret', '()',
@@ -97,6 +99,8 @@ def parseAndTweakModule():
body="""\
#ifdef __WXMSW__
return self->HideNativeCaret();
#else
return false;
#endif
""")

View File

@@ -276,7 +276,7 @@ wxWindow* MyFrame::DoPythonStuff(wxWindow* parent)
wxASSERT(arg != NULL);
PyObject* tuple = PyTuple_New(1);
PyTuple_SET_ITEM(tuple, 0, arg);
result = PyEval_CallObject(func, tuple);
result = PyObject_CallObject(func, tuple);
// Was there an exception?
if (! result)

View File

@@ -50,7 +50,7 @@ void wxPyCallback::EventThunker(wxEvent& event) {
// Call the event handler, passing the event object
tuple = PyTuple_New(1);
PyTuple_SET_ITEM(tuple, 0, arg); // steals ref to arg
result = PyEval_CallObject(func, tuple);
result = PyObject_CallObject(func, tuple);
if ( result ) {
Py_DECREF(result); // result is ignored, but we still need to decref it
PyErr_Clear(); // Just in case...

View File

@@ -84,7 +84,7 @@ protected:
wxPyThreadBlocker blocker;
PyObject* arglist = Py_BuildValue("(i)", bufsize);
PyObject* result = PyEval_CallObject(m_read, arglist);
PyObject* result = PyObject_CallObject(m_read, arglist);
Py_DECREF(arglist);
size_t o = 0;
@@ -122,7 +122,7 @@ protected:
PyTuple_SET_ITEM(arglist, 1, wxPyInt_FromLong(mode));
PyObject* result = PyEval_CallObject(m_seek, arglist);
PyObject* result = PyObject_CallObject(m_seek, arglist);
Py_DECREF(arglist);
Py_XDECREF(result);
return OnSysTell();
@@ -132,7 +132,7 @@ protected:
{
wxPyThreadBlocker blocker;
PyObject* arglist = Py_BuildValue("()");
PyObject* result = PyEval_CallObject(m_tell, arglist);
PyObject* result = PyObject_CallObject(m_tell, arglist);
Py_DECREF(arglist);
wxFileOffset o = 0;
if (result != NULL) {

View File

@@ -92,7 +92,7 @@ protected:
PyObject* arglist = PyTuple_New(1);
PyTuple_SET_ITEM(arglist, 0, PyBytes_FromStringAndSize((char*)buffer, bufsize));
PyObject* result = PyEval_CallObject(m_write, arglist);
PyObject* result = PyObject_CallObject(m_write, arglist);
Py_DECREF(arglist);
if (result != NULL)
@@ -116,7 +116,7 @@ protected:
PyTuple_SET_ITEM(arglist, 1, wxPyInt_FromLong(mode));
PyObject* result = PyEval_CallObject(m_seek, arglist);
PyObject* result = PyObject_CallObject(m_seek, arglist);
Py_DECREF(arglist);
Py_XDECREF(result);
return OnSysTell();
@@ -126,7 +126,7 @@ protected:
{
wxPyThreadBlocker blocker;
PyObject* arglist = Py_BuildValue("()");
PyObject* result = PyEval_CallObject(m_tell, arglist);
PyObject* result = PyObject_CallObject(m_tell, arglist);
Py_DECREF(arglist);
wxFileOffset o = 0;
if (result != NULL) {