Index: Objects/setobject.c =================================================================== --- Objects/setobject.c (revision 61667) +++ Objects/setobject.c (working copy) @@ -984,9 +984,15 @@ return NULL; } + if (type != &PySet_Type && type != &PyFrozenSet_Type) { + if (PyType_IsSubtype(type, &PySet_Type)) + type = &PySet_Type; + else + type = &PyFrozenSet_Type; + } + /* create PySetObject structure */ - if (numfree && - (type == &PySet_Type || type == &PyFrozenSet_Type)) { + if (numfree) { so = free_list[--numfree]; assert (so != NULL && PyAnySet_CheckExact(so)); Py_TYPE(so) = type;