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
This commit is contained in:
Guido van Rossum 2006-03-15 04:58:47 +00:00
parent f3175f6341
commit 45aecf451a
24 changed files with 87 additions and 6365 deletions

View file

@ -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);