The following issues were found

tests/basics/array_intbig.py
2 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 10 Column: 9

                      from array import array
    except ImportError:
        print("SKIP")
        raise SystemExit

print(array('L', [0, 2**32-1]))
print(array('l', [-2**31, 0, 2**31-1]))

print(array('q'))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test array types QqLl that require big-ints

try:
    from uarray import array
except ImportError:
    try:
        from array import array
    except ImportError:
        print("SKIP")

            

Reported by Pylint.

tests/basics/bytearray_construct_endian.py
2 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 9 Column: 9

                      from array import array
    except ImportError:
        print("SKIP")
        raise SystemExit

# arrays
print(bytearray(array('h', [1, 2])))
print(bytearray(array('I', [1, 2])))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test construction of bytearray from different objects
try:
    from uarray import array
except ImportError:
    try:
        from array import array
    except ImportError:
        print("SKIP")
        raise SystemExit

            

Reported by Pylint.

tests/basics/bytes_construct_array.py
2 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 9 Column: 9

                      from array import array
    except ImportError:
        print("SKIP")
        raise SystemExit

# arrays
print(bytes(array('b', [1, 2])))
print(bytes(array('h', [0x101, 0x202])))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test construction of bytes from different objects
try:
    from uarray import array
except ImportError:
    try:
        from array import array
    except ImportError:
        print("SKIP")
        raise SystemExit

            

Reported by Pylint.

py/emitbc.c
2 issues
Uninitialized variable: n
Error

Line: 779 CWE codes: 908

                      t = 2;
    }
    // the lower 2 bits of the opcode argument indicate the collection type
    emit_write_bytecode_byte_uint(emit, -1 - n, MP_BC_STORE_COMP, ((collection_stack_index + n) << 2) | t);
}

void mp_emit_bc_unpack_sequence(emit_t *emit, mp_uint_t n_args) {
    emit_write_bytecode_byte_uint(emit, -1 + n_args, MP_BC_UNPACK_SEQUENCE, n_args);
}

            

Reported by Cppcheck.

Uninitialized variable: t
Error

Line: 779 CWE codes: 908

                      t = 2;
    }
    // the lower 2 bits of the opcode argument indicate the collection type
    emit_write_bytecode_byte_uint(emit, -1 - n, MP_BC_STORE_COMP, ((collection_stack_index + n) << 2) | t);
}

void mp_emit_bc_unpack_sequence(emit_t *emit, mp_uint_t n_args) {
    emit_write_bytecode_byte_uint(emit, -1 + n_args, MP_BC_UNPACK_SEQUENCE, n_args);
}

            

Reported by Cppcheck.

tests/basics/string_splitlines.py
2 issues
Consider explicitly re-raising using the 'from' keyword
Error

Line: 7 Column: 5

                  str.splitlines
except:
    print("SKIP")
    raise SystemExit

# test \n as newline
print("foo\nbar".splitlines())
print("foo\nbar\n".splitlines())
print("foo and\nbar\n".splitlines())

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # test string.splitlines() method

try:
    str.splitlines
except:
    print("SKIP")
    raise SystemExit

# test \n as newline

            

Reported by Pylint.

tests/basics/string_format.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              # basic functionality test for {} format string

def test(fmt, *args):
    print('{:8s}'.format(fmt) + '>' +  fmt.format(*args) + '<')

test("}}{{")
test("{}-{}", 1, [4, 5])
test("{0}-{1}", 1, [4, 5])
test("{1}-{0}", 1, [4, 5])

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 3 Column: 1

              # basic functionality test for {} format string

def test(fmt, *args):
    print('{:8s}'.format(fmt) + '>' +  fmt.format(*args) + '<')

test("}}{{")
test("{}-{}", 1, [4, 5])
test("{0}-{1}", 1, [4, 5])
test("{1}-{0}", 1, [4, 5])

            

Reported by Pylint.

tests/import/gen_context.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              import gen_context2

GLOBAL = "GLOBAL"


def gen():
    print(GLOBAL)
    yield 1


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              GLOBAL = "GLOBAL"


def gen():
    print(GLOBAL)
    yield 1


gen_context2.call(gen())

            

Reported by Pylint.

tests/micropython/stack_use.py
2 issues
Unable to import 'micropython'
Error

Line: 2 Column: 1

              # tests stack_use function in micropython module
import micropython

if not hasattr(micropython, "stack_use"):
    print("SKIP")
else:
    print(type(micropython.stack_use()))  # output varies

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # tests stack_use function in micropython module
import micropython

if not hasattr(micropython, "stack_use"):
    print("SKIP")
else:
    print(type(micropython.stack_use()))  # output varies

            

Reported by Pylint.

tests/basics/lambda_defargs.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              # test default args with lambda

f = lambda x=1: x
print(f(), f(2), f(x=3))

y = 'y'
f = lambda x=y: x
print(f())


            

Reported by Pylint.

Constant name "y" doesn't conform to UPPER_CASE naming style
Error

Line: 6 Column: 1

              f = lambda x=1: x
print(f(), f(2), f(x=3))

y = 'y'
f = lambda x=y: x
print(f())

f = lambda x, y=[]: (x, y)
f(0)[1].append(1)

            

Reported by Pylint.

ports/nrf/device/startup_nrf9160.c
2 issues
Comparing pointers that point to different objects
Error

Line: 129 CWE codes: 570

                  uint32_t * p_src  = &_sidata;
    uint32_t * p_dest = &_sdata;

    while (p_dest < &_edata) {
      *p_dest++ = *p_src++;
    }

    uint32_t * p_bss     = &_sbss;
    uint32_t * p_bss_end = &_ebss;

            

Reported by Cppcheck.

Comparing pointers that point to different objects
Error

Line: 135 CWE codes: 570

              
    uint32_t * p_bss     = &_sbss;
    uint32_t * p_bss_end = &_ebss;
    while (p_bss < p_bss_end) {
        *p_bss++ = 0ul;
    }

    SystemInit();
    _start();

            

Reported by Cppcheck.