More on SF bug [#460020] bug or feature: unicode() and subclasses.

Repaired str(i) to return a genuine string when i is an instance of a str
subclass.  New PyString_CheckExact() macro.
This commit is contained in:
Tim Peters 2001-09-11 01:41:59 +00:00
parent 8ff70a9606
commit 5a49ade70e
4 changed files with 10 additions and 3 deletions

View file

@ -2711,7 +2711,7 @@ str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
tmp = string_new(&PyString_Type, args, kwds);
if (tmp == NULL)
return NULL;
assert(PyString_Check(tmp));
assert(PyString_CheckExact(tmp));
new = type->tp_alloc(type, n = PyString_GET_SIZE(tmp));
if (new != NULL)
memcpy(PyString_AS_STRING(new), PyString_AS_STRING(tmp), n+1);