diff --git a/python/PyQt6/core/auto_generated/auth/qgsauthconfig.sip.in b/python/PyQt6/core/auto_generated/auth/qgsauthconfig.sip.in index 35083202617..8d728d64ae2 100644 --- a/python/PyQt6/core/auto_generated/auth/qgsauthconfig.sip.in +++ b/python/PyQt6/core/auto_generated/auth/qgsauthconfig.sip.in @@ -392,48 +392,101 @@ setCaChain set the CA chain %MappedType QList +/ TypeHintIn = "Iterable[QSslError.SslError]", + TypeHintOut = "List[QSslError.SslError]", TypeHintValue = "[]" / { %TypeHeaderCode -#include +#include %End %ConvertFromTypeCode - // Create the list. - PyObject *l; + PyObject *l = PyList_New( sipCpp->size() ); - if ( ( l = PyList_New( sipCpp->size() ) ) == NULL ) - return NULL; + if ( !l ) + return 0; - // Set the list elements. - QList::iterator it = sipCpp->begin(); - for ( int i = 0; it != sipCpp->end(); ++it, ++i ) + for ( int i = 0; i < sipCpp->size(); ++i ) { - PyObject *tobj; + PyObject *eobj = sipConvertFromEnum( static_cast( sipCpp->at( i ) ), + sipType_QSslError_SslError ); - if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL ) + if ( !eobj ) { Py_DECREF( l ); - return NULL; + + return 0; } - PyList_SET_ITEM( l, i, tobj ); + + PyList_SetItem( l, i, eobj ); } return l; %End %ConvertToTypeCode - // Check the type if that is all that is required. - if ( sipIsErr == NULL ) - return PyList_Check( sipPy ); + PyObject *iter = PyObject_GetIter( sipPy ); - QList *qlist = new QList; - - for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i ) + if ( !sipIsErr ) { - *qlist << ( QSslError::SslError )PyLong_AsLong( PyList_GET_ITEM( sipPy, i ) ); + PyErr_Clear(); + Py_XDECREF( iter ); + + return ( iter && !PyBytes_Check( sipPy ) && !PyUnicode_Check( sipPy ) ); } - *sipCppPtr = qlist; + if ( !iter ) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for ( Py_ssize_t i = 0; ; ++i ) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next( iter ); + + if ( !itm ) + { + if ( PyErr_Occurred() ) + { + delete ql; + Py_DECREF( iter ); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum( itm, sipType_QSslError_SslError ); + + if ( PyErr_Occurred() ) + { + PyErr_Format( PyExc_TypeError, + "index %zd has type '%s' but 'QSslError.SslError' is expected", + i, sipPyTypeName( Py_TYPE( itm ) ) ); + + Py_DECREF( itm ); + delete ql; + Py_DECREF( iter ); + *sipIsErr = 1; + + return 0; + } + + ql->append( static_cast( v ) ); + + Py_DECREF( itm ); + } + + Py_DECREF( iter ); + + *sipCppPtr = ql; + return sipGetState( sipTransferObj ); %End }; diff --git a/python/core/auto_generated/auth/qgsauthconfig.sip.in b/python/core/auto_generated/auth/qgsauthconfig.sip.in index f79d05159c6..8d728d64ae2 100644 --- a/python/core/auto_generated/auth/qgsauthconfig.sip.in +++ b/python/core/auto_generated/auth/qgsauthconfig.sip.in @@ -392,48 +392,101 @@ setCaChain set the CA chain %MappedType QList +/ TypeHintIn = "Iterable[QSslError.SslError]", + TypeHintOut = "List[QSslError.SslError]", TypeHintValue = "[]" / { %TypeHeaderCode -#include +#include %End %ConvertFromTypeCode - // Create the list. - PyObject *l; + PyObject *l = PyList_New( sipCpp->size() ); - if ( ( l = PyList_New( sipCpp->size() ) ) == NULL ) - return NULL; + if ( !l ) + return 0; - // Set the list elements. - QList::iterator it = sipCpp->begin(); - for ( int i = 0; it != sipCpp->end(); ++it, ++i ) + for ( int i = 0; i < sipCpp->size(); ++i ) { - PyObject *tobj; + PyObject *eobj = sipConvertFromEnum( static_cast( sipCpp->at( i ) ), + sipType_QSslError_SslError ); - if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL ) + if ( !eobj ) { Py_DECREF( l ); - return NULL; + + return 0; } - PyList_SET_ITEM( l, i, tobj ); + + PyList_SetItem( l, i, eobj ); } return l; %End %ConvertToTypeCode - // Check the type if that is all that is required. - if ( sipIsErr == NULL ) - return PyList_Check( sipPy ); + PyObject *iter = PyObject_GetIter( sipPy ); - QList *qlist = new QList; - - for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i ) + if ( !sipIsErr ) { - *qlist << ( QSslError::SslError )SIPLong_AsLong( PyList_GET_ITEM( sipPy, i ) ); + PyErr_Clear(); + Py_XDECREF( iter ); + + return ( iter && !PyBytes_Check( sipPy ) && !PyUnicode_Check( sipPy ) ); } - *sipCppPtr = qlist; + if ( !iter ) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for ( Py_ssize_t i = 0; ; ++i ) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next( iter ); + + if ( !itm ) + { + if ( PyErr_Occurred() ) + { + delete ql; + Py_DECREF( iter ); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum( itm, sipType_QSslError_SslError ); + + if ( PyErr_Occurred() ) + { + PyErr_Format( PyExc_TypeError, + "index %zd has type '%s' but 'QSslError.SslError' is expected", + i, sipPyTypeName( Py_TYPE( itm ) ) ); + + Py_DECREF( itm ); + delete ql; + Py_DECREF( iter ); + *sipIsErr = 1; + + return 0; + } + + ql->append( static_cast( v ) ); + + Py_DECREF( itm ); + } + + Py_DECREF( iter ); + + *sipCppPtr = ql; + return sipGetState( sipTransferObj ); %End }; diff --git a/src/core/auth/qgsauthconfig.h b/src/core/auth/qgsauthconfig.h index 951b45f3354..f4ec8744900 100644 --- a/src/core/auth/qgsauthconfig.h +++ b/src/core/auth/qgsauthconfig.h @@ -333,48 +333,101 @@ class CORE_EXPORT QgsPkiConfigBundle #ifdef SIP_RUN % MappedType QList +/ TypeHintIn = "Iterable[QSslError.SslError]", + TypeHintOut = "List[QSslError.SslError]", TypeHintValue = "[]" / { % TypeHeaderCode -#include +#include % End % ConvertFromTypeCode - // Create the list. - PyObject *l; + PyObject *l = PyList_New( sipCpp->size() ); - if ( ( l = PyList_New( sipCpp->size() ) ) == NULL ) - return NULL; + if ( !l ) + return 0; - // Set the list elements. - QList::iterator it = sipCpp->begin(); - for ( int i = 0; it != sipCpp->end(); ++it, ++i ) + for ( int i = 0; i < sipCpp->size(); ++i ) { - PyObject *tobj; + PyObject *eobj = sipConvertFromEnum( static_cast( sipCpp->at( i ) ), + sipType_QSslError_SslError ); - if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL ) + if ( !eobj ) { Py_DECREF( l ); - return NULL; + + return 0; } - PyList_SET_ITEM( l, i, tobj ); + + PyList_SetItem( l, i, eobj ); } return l; % End % ConvertToTypeCode - // Check the type if that is all that is required. - if ( sipIsErr == NULL ) - return PyList_Check( sipPy ); + PyObject *iter = PyObject_GetIter( sipPy ); - QList *qlist = new QList; - - for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i ) + if ( !sipIsErr ) { - *qlist << ( QSslError::SslError )SIPLong_AsLong( PyList_GET_ITEM( sipPy, i ) ); + PyErr_Clear(); + Py_XDECREF( iter ); + + return ( iter && !PyBytes_Check( sipPy ) && !PyUnicode_Check( sipPy ) ); } - *sipCppPtr = qlist; + if ( !iter ) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for ( Py_ssize_t i = 0; ; ++i ) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next( iter ); + + if ( !itm ) + { + if ( PyErr_Occurred() ) + { + delete ql; + Py_DECREF( iter ); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum( itm, sipType_QSslError_SslError ); + + if ( PyErr_Occurred() ) + { + PyErr_Format( PyExc_TypeError, + "index %zd has type '%s' but 'QSslError.SslError' is expected", + i, sipPyTypeName( Py_TYPE( itm ) ) ); + + Py_DECREF( itm ); + delete ql; + Py_DECREF( iter ); + *sipIsErr = 1; + + return 0; + } + + ql->append( static_cast( v ) ); + + Py_DECREF( itm ); + } + + Py_DECREF( iter ); + + *sipCppPtr = ql; + return sipGetState( sipTransferObj ); % End };