summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-04-18 18:06:20 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-04-18 18:06:20 (GMT)
commitafb2c80b29897fba37bfca718df6c4b25c25a166 (patch)
tree0b7d9447ab2581f9ff9355df64444a0b9161a13f /Python
parent16af557ae9c660cbd728546dcb28ec95b0030991 (diff)
downloadcpython-afb2c80b29897fba37bfca718df6c4b25c25a166.zip
cpython-afb2c80b29897fba37bfca718df6c4b25c25a166.tar.gz
cpython-afb2c80b29897fba37bfca718df6c4b25c25a166.tar.bz2
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.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index a93ceea..4e08a2a 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))