From afb2c80b29897fba37bfca718df6c4b25c25a166 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Thu, 18 Apr 2002 18:06:20 +0000 Subject: ceval.c/do_raise(): Tighten the test to disallow raising an instance of a str subclass. test_descr.py/string_exceptions(): New sub-test. For 2.3 only. Guido doesn't want this backported. --- Python/ceval.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Python/ceval.c') diff --git a/Python/ceval.c b/Python/ceval.c index a93ceea128..4e08a2af0a 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2743,7 +2743,10 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb) Py_DECREF(tmp); } - if (PyString_Check(type)) + 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. */ ; else if (PyClass_Check(type)) -- cgit v1.2.1