Commit edb8f353 authored by Stefan Behnel's avatar Stefan Behnel

add another special case to frozenset() that avoids an object creation round trip

parent 3b5438eb
...@@ -424,7 +424,12 @@ static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) { ...@@ -424,7 +424,12 @@ static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) { static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
if (it) { if (it) {
PyObject* result = PyFrozenSet_New(it); PyObject* result;
if (PyFrozenSet_CheckExact(it)) {
Py_INCREF(it);
return it;
}
result = PyFrozenSet_New(it);
if (unlikely(!result)) if (unlikely(!result))
return NULL; return NULL;
if (likely(PySet_GET_SIZE(result))) if (likely(PySet_GET_SIZE(result)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment