diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 8ff733c..04fcf59 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1035,6 +1035,11 @@ builtin_intern(PyObject *self, PyObject *args) PyObject *s; if (!PyArg_ParseTuple(args, "S:intern", &s)) return NULL; + if (!PyString_CheckExact(s)) { + PyErr_SetString(PyExc_TypeError, + "can't intern subclass of string"); + return NULL; + } Py_INCREF(s); PyString_InternInPlace(&s); return s; |