@@ -2717,6 +2717,7 @@ as_unicode_error_attribute(PyObject *attr, const char *name, int as_bytes)
27172717static inline int
27182718check_unicode_error_type (PyObject * self , const char * expect_type )
27192719{
2720+ assert (self != NULL );
27202721 if (!PyUnicodeError_Check (self )) {
27212722 PyErr_Format (PyExc_TypeError ,
27222723 "expecting a %s object, got %T" , expect_type , self );
@@ -2735,6 +2736,7 @@ check_unicode_error_type(PyObject *self, const char *expect_type)
27352736static inline PyObject *
27362737unicode_error_get_encoding_impl (PyObject * self )
27372738{
2739+ assert (self != NULL );
27382740 PyUnicodeErrorObject * exc = PyUnicodeError_CAST (self );
27392741 return as_unicode_error_attribute (exc -> encoding , "encoding" , false);
27402742}
@@ -2750,6 +2752,7 @@ unicode_error_get_encoding_impl(PyObject *self)
27502752static inline PyObject *
27512753unicode_error_get_object_impl (PyObject * self , int as_bytes )
27522754{
2755+ assert (self != NULL );
27532756 PyUnicodeErrorObject * exc = PyUnicodeError_CAST (self );
27542757 return as_unicode_error_attribute (exc -> object , "object" , as_bytes );
27552758}
@@ -2763,6 +2766,7 @@ unicode_error_get_object_impl(PyObject *self, int as_bytes)
27632766static inline PyObject *
27642767unicode_error_get_reason_impl (PyObject * self )
27652768{
2769+ assert (self != NULL );
27662770 PyUnicodeErrorObject * exc = PyUnicodeError_CAST (self );
27672771 return as_unicode_error_attribute (exc -> reason , "reason" , false);
27682772}
@@ -2779,6 +2783,7 @@ unicode_error_get_reason_impl(PyObject *self)
27792783static inline int
27802784unicode_error_set_reason_impl (PyObject * self , const char * reason )
27812785{
2786+ assert (self != NULL );
27822787 PyObject * value = PyUnicode_FromString (reason );
27832788 if (value == NULL ) {
27842789 return -1 ;
@@ -2800,6 +2805,7 @@ unicode_error_set_reason_impl(PyObject *self, const char *reason)
28002805static inline int
28012806unicode_error_set_start_impl (PyObject * self , Py_ssize_t start )
28022807{
2808+ assert (self != NULL );
28032809 PyUnicodeErrorObject * exc = PyUnicodeError_CAST (self );
28042810 exc -> start = start ;
28052811 return 0 ;
@@ -2817,6 +2823,7 @@ unicode_error_set_start_impl(PyObject *self, Py_ssize_t start)
28172823static inline int
28182824unicode_error_set_end_impl (PyObject * self , Py_ssize_t end )
28192825{
2826+ assert (self != NULL );
28202827 PyUnicodeErrorObject * exc = PyUnicodeError_CAST (self );
28212828 exc -> end = end ;
28222829 return 0 ;
@@ -2891,6 +2898,7 @@ _PyUnicodeError_GetParams(PyObject *self,
28912898 Py_ssize_t * start , Py_ssize_t * end ,
28922899 int as_bytes )
28932900{
2901+ assert (self != NULL );
28942902 assert (as_bytes == 0 || as_bytes == 1 );
28952903 PyUnicodeErrorObject * exc = PyUnicodeError_CAST (self );
28962904 PyObject * r = as_unicode_error_attribute (exc -> object , "object" , as_bytes );
@@ -2978,6 +2986,7 @@ PyUnicodeTranslateError_GetObject(PyObject *self)
29782986static inline int
29792987unicode_error_get_start_impl (PyObject * self , Py_ssize_t * start , int as_bytes )
29802988{
2989+ assert (self != NULL );
29812990 return _PyUnicodeError_GetParams (self , NULL , NULL , start , NULL , as_bytes );
29822991}
29832992
@@ -3043,6 +3052,7 @@ PyUnicodeTranslateError_SetStart(PyObject *self, Py_ssize_t start)
30433052static inline int
30443053unicode_error_get_end_impl (PyObject * self , Py_ssize_t * end , int as_bytes )
30453054{
3055+ assert (self != NULL );
30463056 return _PyUnicodeError_GetParams (self , NULL , NULL , NULL , end , as_bytes );
30473057}
30483058
0 commit comments