diff options
author | Guido van Rossum <guido@python.org> | 2006-03-15 04:58:47 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-03-15 04:58:47 +0000 |
commit | 45aecf451a64fb1ebe5e74d0b00965ac8d99dff6 (patch) | |
tree | a7edcfb45ceafcffde68a3542aeba67089ea81cb /Python/ceval.c | |
parent | f3175f6341ae207543a0d2d3be36c457349066e6 (diff) | |
download | cpython-git-45aecf451a64fb1ebe5e74d0b00965ac8d99dff6.tar.gz |
Checkpoint. 218 tests are okay; 53 are failing. Done so far:
- all classes are new-style (but ripping out classobject.[ch] isn't done)
- int/int -> float
- all exceptions must derive from BaseException
- absolute import
- 'as' and 'with' are keywords
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 de2b35b4af..c854fcfe51 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); |