@@ -1418,17 +1418,16 @@ _PyNumber_Index(PyObject *item)
14181418
14191419 if (!PyLong_Check (result )) {
14201420 PyErr_Format (PyExc_TypeError ,
1421- "%.200s.__index__ returned non-int (type %.200s)" ,
1422- Py_TYPE (item )-> tp_name , Py_TYPE (result )-> tp_name );
1421+ "%T.__index__ returned non-int (type %T)" , item , result );
14231422 Py_DECREF (result );
14241423 return NULL ;
14251424 }
14261425 /* Issue #17576: warn if 'result' not of exact type int. */
14271426 if (PyErr_WarnFormat (PyExc_DeprecationWarning , 1 ,
1428- "%.200s. __index__ returned non-int (type %.200s ). "
1427+ "%T. __index__ returned non-int (type %T ). "
14291428 "The ability to return an instance of a strict subclass of int "
14301429 "is deprecated, and may be removed in a future version of Python." ,
1431- Py_TYPE ( item ) -> tp_name , Py_TYPE ( result ) -> tp_name )) {
1430+ item , result )) {
14321431 Py_DECREF (result );
14331432 return NULL ;
14341433 }
@@ -1528,17 +1527,16 @@ PyNumber_Long(PyObject *o)
15281527
15291528 if (!PyLong_Check (result )) {
15301529 PyErr_Format (PyExc_TypeError ,
1531- "%.200s.__int__ returned non-int (type %.200s)" ,
1532- Py_TYPE (o )-> tp_name , Py_TYPE (result )-> tp_name );
1530+ "%T.__int__ returned non-int (type %T)" , o , result );
15331531 Py_DECREF (result );
15341532 return NULL ;
15351533 }
15361534 /* Issue #17576: warn if 'result' not of exact type int. */
15371535 if (PyErr_WarnFormat (PyExc_DeprecationWarning , 1 ,
1538- "%.200s. __int__ returned non-int (type %.200s ). "
1536+ "%T. __int__ returned non-int (type %T ). "
15391537 "The ability to return an instance of a strict subclass of int "
15401538 "is deprecated, and may be removed in a future version of Python." ,
1541- Py_TYPE ( o ) -> tp_name , Py_TYPE ( result ) -> tp_name )) {
1539+ o , result )) {
15421540 Py_DECREF (result );
15431541 return NULL ;
15441542 }
@@ -1606,17 +1604,16 @@ PyNumber_Float(PyObject *o)
16061604
16071605 if (!PyFloat_Check (res )) {
16081606 PyErr_Format (PyExc_TypeError ,
1609- "%.50s.__float__ returned non-float (type %.50s)" ,
1610- Py_TYPE (o )-> tp_name , Py_TYPE (res )-> tp_name );
1607+ "%T.__float__ returned non-float (type %T)" , o , res );
16111608 Py_DECREF (res );
16121609 return NULL ;
16131610 }
16141611 /* Issue #26983: warn if 'res' not of exact type float. */
16151612 if (PyErr_WarnFormat (PyExc_DeprecationWarning , 1 ,
1616- "%.50s. __float__ returned non-float (type %.50s ). "
1613+ "%T. __float__ returned non-float (type %T ). "
16171614 "The ability to return an instance of a strict subclass of float "
16181615 "is deprecated, and may be removed in a future version of Python." ,
1619- Py_TYPE ( o ) -> tp_name , Py_TYPE ( res ) -> tp_name )) {
1616+ o , res )) {
16201617 Py_DECREF (res );
16211618 return NULL ;
16221619 }
@@ -2815,9 +2812,8 @@ PyObject_GetIter(PyObject *o)
28152812 PyObject * res = (* f )(o );
28162813 if (res != NULL && !PyIter_Check (res )) {
28172814 PyErr_Format (PyExc_TypeError ,
2818- "%.100s.iter() returned non-iterator "
2819- "of type '%.100s'" ,
2820- Py_TYPE (o )-> tp_name , Py_TYPE (res )-> tp_name );
2815+ "%T.iter() returned non-iterator of type '%T'" ,
2816+ o , res );
28212817 Py_SETREF (res , NULL );
28222818 }
28232819 return res ;
0 commit comments