@@ -2733,7 +2733,8 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb)
27332733 /* Raising builtin string is deprecated but still allowed --
27342734 * do nothing. Raising an instance of a new-style str
27352735 * subclass is right out. */
2736- ;
2736+ PyErr_Warn (PyExc_PendingDeprecationWarning ,
2737+ "raising a string exception is deprecated" );
27372738
27382739 else if (PyClass_Check (type ))
27392740 PyErr_NormalizeException (& type , & value , & tb );
@@ -2757,8 +2758,9 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb)
27572758 /* Not something you can raise. You get an exception
27582759 anyway, just not what you specified :-) */
27592760 PyErr_Format (PyExc_TypeError ,
2760- "exceptions must be strings, classes, or "
2761- "instances, not %s" , type -> ob_type -> tp_name );
2761+ "exceptions must be classes, instances, or "
2762+ "strings (deprecated), not %s" ,
2763+ type -> ob_type -> tp_name );
27622764 goto raise_error ;
27632765 }
27642766 PyErr_Restore (type , value , tb );
0 commit comments