The following issues were found
tests/internal_bench/var-4-arg.py
3 issues
Line: 1
Column: 1
import bench
def test(num):
i = 0
while i < num:
i += 1
Reported by Pylint.
Line: 1
Column: 1
import bench
def test(num):
i = 0
while i < num:
i += 1
Reported by Pylint.
Line: 4
Column: 1
import bench
def test(num):
i = 0
while i < num:
i += 1
Reported by Pylint.
tests/basics/ordereddict1.py
3 issues
Line: 8
Column: 9
from ucollections import OrderedDict
except ImportError:
print("SKIP")
raise SystemExit
d = OrderedDict([(10, 20), ("b", 100), (1, 2)])
print(len(d))
print(list(d.keys()))
print(list(d.values()))
Reported by Pylint.
Line: 45
Column: 1
print(d.popitem())
try:
d.popitem()
except:
print('empty')
Reported by Pylint.
Line: 1
Column: 1
try:
from collections import OrderedDict
except ImportError:
try:
from ucollections import OrderedDict
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
ports/stm32/machine_adc.c
3 issues
Line: 105
CWE codes:
908
__HAL_RCC_ADC_CONFIG(RCC_ADCCLKSOURCE_SYSCLK);
__HAL_RCC_ADC_CLK_ENABLE();
#else
if (adc == ADC1) {
#if defined(STM32H7)
__HAL_RCC_ADC12_CLK_ENABLE();
#else
__HAL_RCC_ADC1_CLK_ENABLE();
#endif
Reported by Cppcheck.
Line: 430
CWE codes:
908
mp_hal_pin_config(pin, MP_HAL_PIN_MODE_ADC, MP_HAL_PIN_PULL_NONE, 0);
}
adc_config(adc, 12);
machine_adc_obj_t *o = m_new_obj(machine_adc_obj_t);
o->base.type = &machine_adc_type;
o->adc = adc;
o->channel = channel;
Reported by Cppcheck.
Line: 434
CWE codes:
908
machine_adc_obj_t *o = m_new_obj(machine_adc_obj_t);
o->base.type = &machine_adc_type;
o->adc = adc;
o->channel = channel;
o->sample_time = sample_time;
return MP_OBJ_FROM_PTR(o);
}
Reported by Cppcheck.
tests/basics/floordivide.py
3 issues
Line: 1
Column: 1
# check modulo matches python definition
# This tests compiler version
print(123 // 7)
print(-123 // 7)
print(123 // -7)
print(-123 // -7)
a = 10000001
Reported by Pylint.
Line: 9
Column: 1
print(123 // -7)
print(-123 // -7)
a = 10000001
b = 10000000
print(a // b)
print(a // -b)
print(-a // b)
print(-a // -b)
Reported by Pylint.
Line: 10
Column: 1
print(-123 // -7)
a = 10000001
b = 10000000
print(a // b)
print(a // -b)
print(-a // b)
print(-a // -b)
Reported by Pylint.
tests/extmod/ure1.py
3 issues
Line: 8
Column: 9
import re
except ImportError:
print("SKIP")
raise SystemExit
r = re.compile(".+")
m = r.match("abc")
print(m.group(0))
try:
Reported by Pylint.
Line: 91
Column: 1
try:
re.compile("*")
except:
print("Caught invalid regex")
# bytes objects
m = re.match(rb"a+?", b"ab")
print(m.group(0))
Reported by Pylint.
Line: 1
Column: 1
try:
import ure as re
except ImportError:
try:
import re
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
tests/basics/tuple1.py
3 issues
Line: 5
Column: 5
x = (1, 2, 3 * 4)
print(x)
try:
x[0] = 4
except TypeError:
print("TypeError")
print(x)
try:
x.append(5)
Reported by Pylint.
Line: 25
Column: 5
# unsupported unary operation
try:
+()
except TypeError:
print('TypeError')
# unsupported type on RHS of add
try:
Reported by Pylint.
Line: 1
Column: 1
# basic tuple functionality
x = (1, 2, 3 * 4)
print(x)
try:
x[0] = 4
except TypeError:
print("TypeError")
print(x)
try:
Reported by Pylint.
tests/basics/namedtuple_asdict.py
3 issues
Line: 8
Column: 5
from collections import namedtuple
except ImportError:
print("SKIP")
raise SystemExit
t = namedtuple("Tup", ["baz", "foo", "bar"])(3, 2, 5)
try:
t._asdict
Reported by Pylint.
Line: 16
Column: 5
t._asdict
except AttributeError:
print("SKIP")
raise SystemExit
d = t._asdict()
print(list(d.keys()))
print(list(d.values()))
Reported by Pylint.
Line: 1
Column: 1
try:
try:
from ucollections import namedtuple
except ImportError:
from collections import namedtuple
except ImportError:
print("SKIP")
raise SystemExit
Reported by Pylint.
tests/extmod/ure_sub_unmatched.py
3 issues
Line: 10
Column: 9
import re
except ImportError:
print("SKIP")
raise SystemExit
try:
re.sub
except AttributeError:
print("SKIP")
Reported by Pylint.
Line: 16
Column: 5
re.sub
except AttributeError:
print("SKIP")
raise SystemExit
# first group matches, second optional group doesn't so is replaced with a blank
print(re.sub(r"(a)(b)?", r"\2-\1", "1a2"))
Reported by Pylint.
Line: 1
Column: 1
# test re.sub with unmatched groups, behaviour changed in CPython 3.5
try:
import ure as re
except ImportError:
try:
import re
except ImportError:
print("SKIP")
Reported by Pylint.
ports/unix/variants/coverage/frzmpy/frzqstr.py
3 issues
Line: 1
Column: 1
# Checks for regression on MP_QSTR_NULL
def returns_NULL():
return "NULL"
Reported by Pylint.
Line: 2
Column: 1
# Checks for regression on MP_QSTR_NULL
def returns_NULL():
return "NULL"
Reported by Pylint.
Line: 2
Column: 1
# Checks for regression on MP_QSTR_NULL
def returns_NULL():
return "NULL"
Reported by Pylint.
tests/import/try_module.py
3 issues
Line: 1
Column: 1
# Regression test for #290 - throwing exception in another module led to
# its namespace stick and namespace of current module not coming back.
import import1b
def func1():
print("func1")
Reported by Pylint.
Line: 6
Column: 1
import import1b
def func1():
print("func1")
def func2():
try:
Reported by Pylint.
Line: 10
Column: 1
print("func1")
def func2():
try:
import1b.throw()
except ValueError:
pass
func1()
Reported by Pylint.