The following issues were found
tests/basics/gen_yield_from_iter.py
4 issues
Line: 1
Column: 1
def gen():
yield from (1, 2, 3)
def gen2():
yield from gen()
def gen3():
yield from (4, 5)
yield 6
Reported by Pylint.
Line: 1
Column: 1
def gen():
yield from (1, 2, 3)
def gen2():
yield from gen()
def gen3():
yield from (4, 5)
yield 6
Reported by Pylint.
Line: 4
Column: 1
def gen():
yield from (1, 2, 3)
def gen2():
yield from gen()
def gen3():
yield from (4, 5)
yield 6
Reported by Pylint.
Line: 7
Column: 1
def gen2():
yield from gen()
def gen3():
yield from (4, 5)
yield 6
print(list(gen()))
print(list(gen2()))
Reported by Pylint.
tests/basics/gen_yield_from_send.py
4 issues
Line: 8
Column: 1
def gen2():
print((yield from gen()))
g = gen2()
next(g)
print("yielded:", g.send("val"))
try:
next(g)
except StopIteration:
Reported by Pylint.
Line: 1
Column: 1
def gen():
print("sent:", (yield 1))
yield 2
def gen2():
print((yield from gen()))
g = gen2()
next(g)
Reported by Pylint.
Line: 1
Column: 1
def gen():
print("sent:", (yield 1))
yield 2
def gen2():
print((yield from gen()))
g = gen2()
next(g)
Reported by Pylint.
Line: 5
Column: 1
print("sent:", (yield 1))
yield 2
def gen2():
print((yield from gen()))
g = gen2()
next(g)
print("yielded:", g.send("val"))
Reported by Pylint.
tests/basics/generator_return.py
4 issues
Line: 1
Column: 1
def gen():
yield 1
return 42
g = gen()
print(next(g))
try:
print(next(g))
except StopIteration as e:
Reported by Pylint.
Line: 1
Column: 1
def gen():
yield 1
return 42
g = gen()
print(next(g))
try:
print(next(g))
except StopIteration as e:
Reported by Pylint.
Line: 9
Column: 1
print(next(g))
try:
print(next(g))
except StopIteration as e:
print(type(e), e.args)
# trying next again should raise StopIteration with no arguments
try:
print(next(g))
Reported by Pylint.
Line: 15
Column: 1
# trying next again should raise StopIteration with no arguments
try:
print(next(g))
except StopIteration as e:
print(type(e), e.args)
Reported by Pylint.
tests/basics/int_big_div.py
4 issues
Line: 1
Column: 1
for lhs in (1000000000000000000000000, 10000000000100000000000000, 10012003400000000000000007, 12349083434598210349871029923874109871234789):
for rhs in range(1, 555):
print(lhs // rhs)
# these check an edge case on 64-bit machines where two mpz limbs
# are used and the most significant one has the MSB set
x = 0x8000000000000000
print((x + 1) // x)
x = 0x86c60128feff5330
Reported by Pylint.
Line: 1
Column: 1
for lhs in (1000000000000000000000000, 10000000000100000000000000, 10012003400000000000000007, 12349083434598210349871029923874109871234789):
for rhs in range(1, 555):
print(lhs // rhs)
# these check an edge case on 64-bit machines where two mpz limbs
# are used and the most significant one has the MSB set
x = 0x8000000000000000
print((x + 1) // x)
x = 0x86c60128feff5330
Reported by Pylint.
Line: 7
Column: 1
# these check an edge case on 64-bit machines where two mpz limbs
# are used and the most significant one has the MSB set
x = 0x8000000000000000
print((x + 1) // x)
x = 0x86c60128feff5330
print((x + 1) // x)
# these check edge cases where borrow overflows
Reported by Pylint.
Line: 9
Column: 1
# are used and the most significant one has the MSB set
x = 0x8000000000000000
print((x + 1) // x)
x = 0x86c60128feff5330
print((x + 1) // x)
# these check edge cases where borrow overflows
print((2 ** 48 - 1) ** 2 // (2 ** 48 - 1))
print((2 ** 256 - 2 ** 32) ** 2 // (2 ** 256 - 2 ** 32))
Reported by Pylint.
tests/basics/int_big_mod.py
4 issues
Line: 1
Column: 1
# test % operation on big integers
delta = 100000000000000000000000000000012345
for i in range(11):
for j in range(11):
x = delta * (i - 5)
y = delta * (j - 5)
if y != 0:
Reported by Pylint.
Line: 3
Column: 1
# test % operation on big integers
delta = 100000000000000000000000000000012345
for i in range(11):
for j in range(11):
x = delta * (i - 5)
y = delta * (j - 5)
if y != 0:
Reported by Pylint.
Line: 14
Column: 1
# these check an edge case on 64-bit machines where two mpz limbs
# are used and the most significant one has the MSB set
x = 0x8000000000000000
print((x + 1) % x)
x = 0x86c60128feff5330
print((x + 1) % x)
Reported by Pylint.
Line: 16
Column: 1
# are used and the most significant one has the MSB set
x = 0x8000000000000000
print((x + 1) % x)
x = 0x86c60128feff5330
print((x + 1) % x)
Reported by Pylint.
tests/basics/int_small.py
4 issues
Line: 1
Column: 1
# This tests small int range for 32-bit machine
# Small ints are variable-length encoded in MicroPython, so first
# test that encoding works as expected.
print(0)
print(1)
print(-1)
# Value is split in 7-bit "subwords", and taking into account that all
Reported by Pylint.
Line: 38
Column: 1
print(-3)
print(~3)
a = 0x3fffff
print(a)
a *= 0x10
print(a)
a *= 0x10
print(a)
Reported by Pylint.
Line: 49
Column: 1
# This would overflow
#a += 1
a = -0x3fffff
print(a)
a *= 0x10
print(a)
a *= 0x10
print(a)
Reported by Pylint.
Line: 81
Column: 1
print(1 >> 128)
# These are runtime calcs
a = 1
print(a >> 32)
print(a >> 64)
print(a >> 128)
Reported by Pylint.
tests/basics/list_slice.py
4 issues
Line: 1
Column: 1
# test list slices, getting values
x = list(range(10))
print(x[1:])
print(x[:-1])
print(x[2:3])
a = 2
Reported by Pylint.
Line: 9
Column: 1
print(x[:-1])
print(x[2:3])
a = 2
b = 4
c = 3
print(x[:])
print(x[::])
print(x[::c])
Reported by Pylint.
Line: 10
Column: 1
print(x[2:3])
a = 2
b = 4
c = 3
print(x[:])
print(x[::])
print(x[::c])
print(x[:b])
Reported by Pylint.
Line: 11
Column: 1
a = 2
b = 4
c = 3
print(x[:])
print(x[::])
print(x[::c])
print(x[:b])
print(x[:b:])
Reported by Pylint.
tests/basics/list_sort.py
4 issues
Line: 1
Column: 1
l = [1, 3, 2, 5]
print(l)
print(sorted(l))
l.sort()
print(l)
print(l == sorted(l))
print(sorted(l, key=lambda x: -x))
Reported by Pylint.
Line: 37
Column: 1
print(l[0], l[-1])
# test user-defined ordering
class A:
def __init__(self, x):
self.x = x
def __lt__(self, other):
return self.x > other.x
def __repr__(self):
Reported by Pylint.
Line: 37
Column: 1
print(l[0], l[-1])
# test user-defined ordering
class A:
def __init__(self, x):
self.x = x
def __lt__(self, other):
return self.x > other.x
def __repr__(self):
Reported by Pylint.
Line: 39
Column: 9
# test user-defined ordering
class A:
def __init__(self, x):
self.x = x
def __lt__(self, other):
return self.x > other.x
def __repr__(self):
return str(self.x)
l = [A(5), A(2), A(1), A(3), A(4)]
Reported by Pylint.
tests/basics/op_error_literal.py
4 issues
Line: 6
Column: 5
# unsupported subscription
try:
1[0]
except TypeError:
print("TypeError")
try:
""[""]
except TypeError:
Reported by Pylint.
Line: 10
Column: 5
except TypeError:
print("TypeError")
try:
""[""]
except TypeError:
print("TypeError")
# not callable
try:
Reported by Pylint.
Line: 16
Column: 5
# not callable
try:
1()
except TypeError:
print("TypeError")
Reported by Pylint.
Line: 1
Column: 1
# test errors from bad operations with literals
# these raise a SyntaxWarning in CPython; see https://bugs.python.org/issue15248
# unsupported subscription
try:
1[0]
except TypeError:
print("TypeError")
try:
Reported by Pylint.
tests/basics/set_type.py
4 issues
Line: 9
Column: 5
set
except NameError:
print("SKIP")
raise SystemExit
print(set)
print(type(set()) == set)
Reported by Pylint.
Line: 1
Column: 1
# set type
# This doesn't really work as expected, because {None}
# leads SyntaxError during parsing.
try:
set
except NameError:
print("SKIP")
raise SystemExit
Reported by Pylint.
Line: 13
Column: 7
print(set)
print(type(set()) == set)
print(type({None}) == set)
Reported by Pylint.
Line: 15
Column: 7
print(type(set()) == set)
print(type({None}) == set)
Reported by Pylint.