mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
fix string/array (sequence) multiplications with integer.
This commit is contained in:
@@ -250,6 +250,8 @@ def _element_calculate(evaluator, left, operator, right):
|
|||||||
# for iterables, ignore * operations
|
# for iterables, ignore * operations
|
||||||
if isinstance(left, iterable.Array) or _is_string(left):
|
if isinstance(left, iterable.Array) or _is_string(left):
|
||||||
return [left]
|
return [left]
|
||||||
|
elif isinstance(right, iterable.Array) or _is_string(right):
|
||||||
|
return [right]
|
||||||
elif operator == '+':
|
elif operator == '+':
|
||||||
if _is_number(left) and _is_number(right) or _is_string(left) and _is_string(right):
|
if _is_number(left) and _is_number(right) or _is_string(left) and _is_string(right):
|
||||||
return [create(evaluator, left.obj + right.obj)]
|
return [create(evaluator, left.obj + right.obj)]
|
||||||
|
|||||||
@@ -56,14 +56,6 @@ a = ['']*2
|
|||||||
#? list()
|
#? list()
|
||||||
a
|
a
|
||||||
|
|
||||||
a = 2*2
|
|
||||||
#? int()
|
|
||||||
a
|
|
||||||
|
|
||||||
a = "a"*3
|
|
||||||
#? str()
|
|
||||||
a
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# tuple assignments
|
# tuple assignments
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
@@ -41,6 +41,14 @@ x = 'upp' + 'e'
|
|||||||
#? str.upper
|
#? str.upper
|
||||||
getattr(str, x + 'r')
|
getattr(str, x + 'r')
|
||||||
|
|
||||||
|
a = "a"*3
|
||||||
|
#? str()
|
||||||
|
a
|
||||||
|
a = 3 * "a"
|
||||||
|
#? str()
|
||||||
|
a
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# assignments
|
# assignments
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
Reference in New Issue
Block a user