mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-30249: Check array size to prevent AOBE
This commit is contained in:
@@ -61,7 +61,7 @@ private fun getParametersFromDecorator(decorator: PyDecorator, evalContext: Type
|
||||
parameterTypes[i] = PyUnionType.union(members.map { (it as? PyTupleType)?.getElementType(i) })
|
||||
}
|
||||
}
|
||||
is PyTupleType -> iteratedItemType.elementTypes.forEachIndexed { i, type -> parameterTypes[i] = type }
|
||||
is PyTupleType -> iteratedItemType.elementTypes.forEachIndexed { i, type -> if (parameterTypes.size > i) parameterTypes[i] = type }
|
||||
!is PyCollectionType -> parameterTypes.fill(iteratedItemType)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,3 +12,7 @@ def test_returns_correct_result(test_input, expected, x, y): # False positive:
|
||||
x.bit_length()
|
||||
test_input.__len__()
|
||||
expected.bit_length()
|
||||
|
||||
@pytest.mark.parametrize(('x', 'y'), [(1, 2, 3, 4)]) # Too many values in tuple, should be 2
|
||||
def test_wrong_number_of_parameters(x, y):
|
||||
x.bit_length()
|
||||
|
||||
@@ -12,3 +12,7 @@ def test_returns_correct_result(test_input, expected, x, y): # False positive:
|
||||
x.bit_len<caret>
|
||||
test_input.len<caret>
|
||||
expected.bit_len<caret>
|
||||
|
||||
@pytest.mark.parametrize(('x', 'y'), [(1, 2, 3, 4)]) # Too many values in tuple, should be 2
|
||||
def test_wrong_number_of_parameters(x, y):
|
||||
x.bit_len<caret>
|
||||
|
||||
Reference in New Issue
Block a user