diff options
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index de2b35b..c854fcf 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3025,15 +3025,7 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb) Py_DECREF(tmp); } - if (PyString_CheckExact(type)) { - /* Raising builtin string is deprecated but still allowed -- - * do nothing. Raising an instance of a new-style str - * subclass is right out. */ - if (PyErr_Warn(PyExc_DeprecationWarning, - "raising a string exception is deprecated")) - goto raise_error; - } - else if (PyExceptionClass_Check(type)) + if (PyExceptionClass_Check(type)) PyErr_NormalizeException(&type, &value, &tb); else if (PyExceptionInstance_Check(type)) { @@ -3054,10 +3046,8 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb) else { /* Not something you can raise. You get an exception anyway, just not what you specified :-) */ - PyErr_Format(PyExc_TypeError, - "exceptions must be classes, instances, or " - "strings (deprecated), not %s", - type->ob_type->tp_name); + PyErr_SetString(PyExc_TypeError, + "exceptions must derive from BaseException"); goto raise_error; } PyErr_Restore(type, value, tb); @@ -4148,7 +4138,7 @@ build_class(PyObject *methods, PyObject *bases, PyObject *name) if (g != NULL && PyDict_Check(g)) metaclass = PyDict_GetItemString(g, "__metaclass__"); if (metaclass == NULL) - metaclass = (PyObject *) &PyClass_Type; + metaclass = (PyObject *) &PyType_Type; Py_INCREF(metaclass); } result = PyObject_CallFunction(metaclass, "OOO", name, bases, methods); |