Permalink
Browse files

Avoid uninitialised C variable (and thus potentially undefined behavi…

…our), even if it's not actually being used in that case.
  • Loading branch information...
scoder committed Apr 17, 2018
1 parent 31311d3 commit ee1b02191853e40a0078114c29de5cf7d794ba66
Showing with 6 additions and 6 deletions.
  1. +6 −6 Cython/Utility/Optimize.c
View
@@ -438,17 +438,17 @@ static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set
#if CYTHON_COMPILING_IN_CPYTHON
is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
*p_source_is_set = is_set;
- if (unlikely(!is_set))
- return PyObject_GetIter(iterable);
- *p_orig_length = PySet_Size(iterable);
- Py_INCREF(iterable);
- return iterable;
+ if (likely(is_set)) {
+ *p_orig_length = PySet_Size(iterable);
+ Py_INCREF(iterable);
+ return iterable;
+ }
#else
(void)is_set;
*p_source_is_set = 0;
+#endif
*p_orig_length = 0;
return PyObject_GetIter(iterable);
-#endif
}
static CYTHON_INLINE int __Pyx_set_iter_next(

0 comments on commit ee1b021

Please sign in to comment.