NoneType was incorrectly passed to PyString_AsString

The implementation relied on the fact that PyString_AsString is returning NULL
for invalid inputs (and causing an error condition), which is then fixed by the
call to FROM_UTF8. Now, we will simply return an empty string if Py_None is
returned by a python fuction, which resemebles the old behaviour of those methods
This commit is contained in:
Thomas Pointhuber 2018-08-15 13:45:14 +02:00 committed by Maciej Suminski
parent 4a2a76af37
commit 8bf1954625
1 changed files with 10 additions and 0 deletions

View File

@ -99,6 +99,11 @@ wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod( const char* aMethod, PyObjec
PyObject* result = CallMethod( aMethod, aArglist );
if ( result == Py_None ) {
Py_DECREF( result );
return ret;
}
if( result )
{
#if PY_MAJOR_VERSION >= 3
@ -214,6 +219,11 @@ wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName( int aPage )
Py_DECREF( arglist );
if ( result == Py_None ) {
Py_DECREF( result );
return ret;
}
if( result )
{
#if PY_MAJOR_VERSION >= 3