minor fixes to Converter.ToArray:
- no longer leaking iterator object on failure - when iteration stops due to error, propagates the error
This commit is contained in:
Родитель
146ebf3f3d
Коммит
272687bfdb
|
@ -888,6 +888,7 @@ namespace Python.Runtime
|
|||
if (!Converter.ToManaged(item, elementType, out obj, setError))
|
||||
{
|
||||
Runtime.XDecref(item);
|
||||
Runtime.XDecref(IterObject);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -896,6 +897,12 @@ namespace Python.Runtime
|
|||
}
|
||||
Runtime.XDecref(IterObject);
|
||||
|
||||
if (Exceptions.ErrorOccurred())
|
||||
{
|
||||
if (!setError) Exceptions.Clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
Array items = Array.CreateInstance(elementType, list.Count);
|
||||
list.CopyTo(items, 0);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче