@@ -3654,16 +3654,9 @@ object_format(PyObject *self, PyObject *args)
36543654 /* Issue 7994: If we're converting to a string, we
36553655 should reject format specifications */
36563656 if (PyUnicode_GET_LENGTH (format_spec ) > 0 ) {
3657- if (PyErr_WarnEx (PyExc_DeprecationWarning ,
3658- "object.__format__ with a non-empty format "
3659- "string is deprecated" , 1 ) < 0 ) {
3660- goto done ;
3661- }
3662- /* Eventually this will become an error:
3663- PyErr_Format(PyExc_TypeError,
3657+ PyErr_SetString (PyExc_TypeError ,
36643658 "non-empty format string passed to object.__format__" );
3665- goto done;
3666- */
3659+ goto done ;
36673660 }
36683661
36693662 result = PyObject_Format (self_as_str , format_spec );
@@ -4288,13 +4281,11 @@ PyType_Ready(PyTypeObject *type)
42884281 /* Warn for a type that implements tp_compare (now known as
42894282 tp_reserved) but not tp_richcompare. */
42904283 if (type -> tp_reserved && !type -> tp_richcompare ) {
4291- int error ;
4292- error = PyErr_WarnFormat (PyExc_DeprecationWarning , 1 ,
4284+ PyErr_Format (PyExc_TypeError ,
42934285 "Type %.100s defines tp_reserved (formerly tp_compare) "
42944286 "but not tp_richcompare. Comparisons may not behave as intended." ,
42954287 type -> tp_name );
4296- if (error == -1 )
4297- goto error ;
4288+ goto error ;
42984289 }
42994290
43004291 /* All done -- set the ready flag */
0 commit comments