Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 36988:49c6eb688906
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
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 15 Mar 2006 04:58:47 +0000 |
| parents | fc10ff322df1 |
| children | 25007c155668 |
line wrap: on
line diff
--- a/Python/ceval.c Tue Mar 14 22:22:15 2006 +0000 +++ b/Python/ceval.c Wed Mar 15 04:58:47 2006 +0000 @@ -3025,15 +3025,7 @@ 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 @@ 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 @@ 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);
