The following issues were found

Lib/ctypes/test/test_slicing.py
98 issues
Unused import c_ulonglong from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *
from ctypes.test import need_symbol

import _ctypes_test

class SlicesTestCase(unittest.TestCase):
    def test_getslice_cint(self):
        a = (c_int * 100)(*range(1100, 1200))

            

Reported by Pylint.

Unused import kind from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *
from ctypes.test import need_symbol

import _ctypes_test

class SlicesTestCase(unittest.TestCase):
    def test_getslice_cint(self):
        a = (c_int * 100)(*range(1100, 1200))

            

Reported by Pylint.

Unused import c_int16 from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *
from ctypes.test import need_symbol

import _ctypes_test

class SlicesTestCase(unittest.TestCase):
    def test_getslice_cint(self):
        a = (c_int * 100)(*range(1100, 1200))

            

Reported by Pylint.

Unused import c_int32 from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *
from ctypes.test import need_symbol

import _ctypes_test

class SlicesTestCase(unittest.TestCase):
    def test_getslice_cint(self):
        a = (c_int * 100)(*range(1100, 1200))

            

Reported by Pylint.

Unused import c_int64 from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *
from ctypes.test import need_symbol

import _ctypes_test

class SlicesTestCase(unittest.TestCase):
    def test_getslice_cint(self):
        a = (c_int * 100)(*range(1100, 1200))

            

Reported by Pylint.

Unused import c_uint16 from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *
from ctypes.test import need_symbol

import _ctypes_test

class SlicesTestCase(unittest.TestCase):
    def test_getslice_cint(self):
        a = (c_int * 100)(*range(1100, 1200))

            

Reported by Pylint.

Unused import c_uint32 from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *
from ctypes.test import need_symbol

import _ctypes_test

class SlicesTestCase(unittest.TestCase):
    def test_getslice_cint(self):
        a = (c_int * 100)(*range(1100, 1200))

            

Reported by Pylint.

Unused import c_uint64 from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *
from ctypes.test import need_symbol

import _ctypes_test

class SlicesTestCase(unittest.TestCase):
    def test_getslice_cint(self):
        a = (c_int * 100)(*range(1100, 1200))

            

Reported by Pylint.

Unused import Union from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *
from ctypes.test import need_symbol

import _ctypes_test

class SlicesTestCase(unittest.TestCase):
    def test_getslice_cint(self):
        a = (c_int * 100)(*range(1100, 1200))

            

Reported by Pylint.

Unused import Structure from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *
from ctypes.test import need_symbol

import _ctypes_test

class SlicesTestCase(unittest.TestCase):
    def test_getslice_cint(self):
        a = (c_int * 100)(*range(1100, 1200))

            

Reported by Pylint.

Lib/ctypes/test/test_random_things.py
98 issues
Unused import c_int64 from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import contextlib
from test import support
import unittest
import sys


def callback_func(arg):
    42 / arg

            

Reported by Pylint.

Unused import LittleEndianStructure from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import contextlib
from test import support
import unittest
import sys


def callback_func(arg):
    42 / arg

            

Reported by Pylint.

Unused import BigEndianStructure from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import contextlib
from test import support
import unittest
import sys


def callback_func(arg):
    42 / arg

            

Reported by Pylint.

Unused import set_last_error from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import contextlib
from test import support
import unittest
import sys


def callback_func(arg):
    42 / arg

            

Reported by Pylint.

Unused import get_last_error from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import contextlib
from test import support
import unittest
import sys


def callback_func(arg):
    42 / arg

            

Reported by Pylint.

Unused import pointer from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import contextlib
from test import support
import unittest
import sys


def callback_func(arg):
    42 / arg

            

Reported by Pylint.

Unused import POINTER from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import contextlib
from test import support
import unittest
import sys


def callback_func(arg):
    42 / arg

            

Reported by Pylint.

Unused import set_errno from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import contextlib
from test import support
import unittest
import sys


def callback_func(arg):
    42 / arg

            

Reported by Pylint.

Unused import get_errno from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import contextlib
from test import support
import unittest
import sys


def callback_func(arg):
    42 / arg

            

Reported by Pylint.

Unused import resize from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
import contextlib
from test import support
import unittest
import sys


def callback_func(arg):
    42 / arg

            

Reported by Pylint.

Lib/idlelib/rpc.py
98 issues
Cannot import 'traceback' due to syntax error 'invalid syntax (<unknown>, line 576)'
Error

Line: 42 Column: 1

              import struct
import sys
import threading
import traceback
import types

def unpickle_code(ms):
    "Return code object from marshal string ms."
    co = marshal.loads(ms)

            

Reported by Pylint.

The raise statement is not inside an except clause
Error

Line: 106 Column: 13

              
        """
        try:
            raise
        except SystemExit:
            raise
        except:
            erf = sys.__stderr__
            print('\n' + '-'*40, file=erf)

            

Reported by Pylint.

Instance of 'SocketIO' has no 'location' member
Error

Line: 156 Column: 13

                  def debug(self, *args):
        if not self.debugging:
            return
        s = self.location + " " + str(threading.current_thread().name)
        for a in args:
            s = s + " " + str(a)
        print(s, file=sys.__stderr__)

    def register(self, oid, object):

            

Reported by Pylint.

Deserialization with the marshal module is possibly dangerous.
Security blacklist

Line: 47
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b302-marshal

              
def unpickle_code(ms):
    "Return code object from marshal string ms."
    co = marshal.loads(ms)
    assert isinstance(co, types.CodeType)
    return co

def pickle_code(co):
    "Return unpickle function and tuple with marshalled co code object."

            

Reported by Bandit.

Unnecessary pass statement
Error

Line: 82 Column: 9

              
    def server_bind(self):
        "Override TCPServer method, no bind() phase for connecting entity"
        pass

    def server_activate(self):
        """Override TCPServer method, connect() instead of listen()

        Due to the reversed connection, self.server_address is actually the

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 109 Column: 9

                          raise
        except SystemExit:
            raise
        except:
            erf = sys.__stderr__
            print('\n' + '-'*40, file=erf)
            print('Unhandled server exception!', file=erf)
            print('Thread: %s' % threading.current_thread().name, file=erf)
            print('Client Address: ', client_address, file=erf)

            

Reported by Pylint.

Access to a protected member _exit of a client class
Error

Line: 119 Column: 13

                          traceback.print_exc(file=erf)
            print('\n*** Unrecoverable, server exiting!', file=erf)
            print('-'*40, file=erf)
            os._exit(0)

#----------------- end class RPCServer --------------------

objecttable = {}
request_queue = queue.Queue(0)

            

Reported by Pylint.

Access to a protected member _exit of a client class
Error

Line: 151 Column: 9

              
    def exithook(self):
        "override for specific exit action"
        os._exit(0)

    def debug(self, *args):
        if not self.debugging:
            return
        s = self.location + " " + str(threading.current_thread().name)

            

Reported by Pylint.

Redefining built-in 'object'
Error

Line: 161 Column: 29

                          s = s + " " + str(a)
        print(s, file=sys.__stderr__)

    def register(self, oid, object):
        self.objtable[oid] = object

    def unregister(self, oid):
        try:
            del self.objtable[oid]

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 207 Column: 16

                          raise
        except OSError:
            raise
        except Exception as ex:
            return ("CALLEXC", ex)
        except:
            msg = "*** Internal Error: rpc.py:SocketIO.localcall()\n\n"\
                  " Object: %s \n Method: %s \n Args: %s\n"
            print(msg % (oid, method, args), file=sys.__stderr__)

            

Reported by Pylint.

Lib/ctypes/test/test_cast.py
98 issues
Unused import LittleEndianStructure from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys

class Test(unittest.TestCase):

    def test_array2pointer(self):
        array = (c_int * 3)(42, 17, 2)

            

Reported by Pylint.

Unused import string_at from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys

class Test(unittest.TestCase):

    def test_array2pointer(self):
        array = (c_int * 3)(42, 17, 2)

            

Reported by Pylint.

Unused import wstring_at from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys

class Test(unittest.TestCase):

    def test_array2pointer(self):
        array = (c_int * 3)(42, 17, 2)

            

Reported by Pylint.

Unused import DllGetClassObject from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys

class Test(unittest.TestCase):

    def test_array2pointer(self):
        array = (c_int * 3)(42, 17, 2)

            

Reported by Pylint.

Unused import DllCanUnloadNow from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys

class Test(unittest.TestCase):

    def test_array2pointer(self):
        array = (c_int * 3)(42, 17, 2)

            

Reported by Pylint.

Unused import c_int8 from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys

class Test(unittest.TestCase):

    def test_array2pointer(self):
        array = (c_int * 3)(42, 17, 2)

            

Reported by Pylint.

Unused import c_uint8 from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys

class Test(unittest.TestCase):

    def test_array2pointer(self):
        array = (c_int * 3)(42, 17, 2)

            

Reported by Pylint.

Unused import kind from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys

class Test(unittest.TestCase):

    def test_array2pointer(self):
        array = (c_int * 3)(42, 17, 2)

            

Reported by Pylint.

Unused import c_int16 from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys

class Test(unittest.TestCase):

    def test_array2pointer(self):
        array = (c_int * 3)(42, 17, 2)

            

Reported by Pylint.

Unused import c_int32 from wildcard import
Error

Line: 1 Column: 1

              from ctypes import *
from ctypes.test import need_symbol
import unittest
import sys

class Test(unittest.TestCase):

    def test_array2pointer(self):
        array = (c_int * 3)(42, 17, 2)

            

Reported by Pylint.

Lib/wsgiref/validate.py
98 issues
Using deprecated method assert_()
Error

Line: 149 Column: 9

                  """

    def lint_app(*args, **kw):
        assert_(len(args) == 2, "Two arguments required")
        assert_(not kw, "No keyword arguments allowed")
        environ, start_response = args

        check_environ(environ)


            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 150 Column: 9

              
    def lint_app(*args, **kw):
        assert_(len(args) == 2, "Two arguments required")
        assert_(not kw, "No keyword arguments allowed")
        environ, start_response = args

        check_environ(environ)

        # We use this to check if the application returns without

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 160 Column: 13

                      start_response_started = []

        def start_response_wrapper(*args, **kw):
            assert_(len(args) == 2 or len(args) == 3, (
                "Invalid number of arguments: %s" % (args,)))
            assert_(not kw, "No keyword arguments allowed")
            status = args[0]
            headers = args[1]
            if len(args) == 3:

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 162 Column: 13

                      def start_response_wrapper(*args, **kw):
            assert_(len(args) == 2 or len(args) == 3, (
                "Invalid number of arguments: %s" % (args,)))
            assert_(not kw, "No keyword arguments allowed")
            status = args[0]
            headers = args[1]
            if len(args) == 3:
                exc_info = args[2]
            else:

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 182 Column: 9

                      environ['wsgi.errors'] = ErrorWrapper(environ['wsgi.errors'])

        iterator = application(environ, start_response_wrapper)
        assert_(iterator is not None and iterator != False,
            "The application must return an iterator, if only an empty list")

        check_iterator(iterator)

        return IteratorWrapper(iterator, start_response_started)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 197 Column: 9

                      self.input = wsgi_input

    def read(self, *args):
        assert_(len(args) == 1)
        v = self.input.read(*args)
        assert_(type(v) is bytes)
        return v

    def readline(self, *args):

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 199 Column: 9

                  def read(self, *args):
        assert_(len(args) == 1)
        v = self.input.read(*args)
        assert_(type(v) is bytes)
        return v

    def readline(self, *args):
        assert_(len(args) <= 1)
        v = self.input.readline(*args)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 203 Column: 9

                      return v

    def readline(self, *args):
        assert_(len(args) <= 1)
        v = self.input.readline(*args)
        assert_(type(v) is bytes)
        return v

    def readlines(self, *args):

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 205 Column: 9

                  def readline(self, *args):
        assert_(len(args) <= 1)
        v = self.input.readline(*args)
        assert_(type(v) is bytes)
        return v

    def readlines(self, *args):
        assert_(len(args) <= 1)
        lines = self.input.readlines(*args)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 209 Column: 9

                      return v

    def readlines(self, *args):
        assert_(len(args) <= 1)
        lines = self.input.readlines(*args)
        assert_(type(lines) is list)
        for line in lines:
            assert_(type(line) is bytes)
        return lines

            

Reported by Pylint.

Tools/scripts/which.py
98 issues
Starting a process with a shell, possible injection detected, security issue.
Security injection

Line: 51
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b605_start_process_with_a_shell.html

                              else:
                    msg(filename + ': not executable')
            if longlist:
                sts = os.system('ls ' + longlist + ' ' + filename)
                sts = os.waitstatus_to_exitcode(sts)
                if sts: msg('"ls -l" exit status: ' + repr(sts))
        if not ident:
            msg(prog + ': not found')
            sts = 1

            

Reported by Bandit.

Module 'os' has no 'waitstatus_to_exitcode' member
Error

Line: 52 Column: 23

                                  msg(filename + ': not executable')
            if longlist:
                sts = os.system('ls ' + longlist + ' ' + filename)
                sts = os.waitstatus_to_exitcode(sts)
                if sts: msg('"ls -l" exit status: ' + repr(sts))
        if not ident:
            msg(prog + ': not found')
            sts = 1


            

Reported by Pylint.

Reimport 'sys' (imported line 7)
Error

Line: 10 Column: 1

              import sys
if sys.path[0] in (".", ""): del sys.path[0]

import sys, os
from stat import *

def msg(str):
    sys.stderr.write(str + '\n')


            

Reported by Pylint.

Unused import ST_NLINK from wildcard import
Error

Line: 11 Column: 1

              if sys.path[0] in (".", ""): del sys.path[0]

import sys, os
from stat import *

def msg(str):
    sys.stderr.write(str + '\n')

def main():

            

Reported by Pylint.

Unused import ST_UID from wildcard import
Error

Line: 11 Column: 1

              if sys.path[0] in (".", ""): del sys.path[0]

import sys, os
from stat import *

def msg(str):
    sys.stderr.write(str + '\n')

def main():

            

Reported by Pylint.

Unused import ST_GID from wildcard import
Error

Line: 11 Column: 1

              if sys.path[0] in (".", ""): del sys.path[0]

import sys, os
from stat import *

def msg(str):
    sys.stderr.write(str + '\n')

def main():

            

Reported by Pylint.

Unused import ST_SIZE from wildcard import
Error

Line: 11 Column: 1

              if sys.path[0] in (".", ""): del sys.path[0]

import sys, os
from stat import *

def msg(str):
    sys.stderr.write(str + '\n')

def main():

            

Reported by Pylint.

Unused import ST_ATIME from wildcard import
Error

Line: 11 Column: 1

              if sys.path[0] in (".", ""): del sys.path[0]

import sys, os
from stat import *

def msg(str):
    sys.stderr.write(str + '\n')

def main():

            

Reported by Pylint.

Unused import ST_MTIME from wildcard import
Error

Line: 11 Column: 1

              if sys.path[0] in (".", ""): del sys.path[0]

import sys, os
from stat import *

def msg(str):
    sys.stderr.write(str + '\n')

def main():

            

Reported by Pylint.

Unused import ST_CTIME from wildcard import
Error

Line: 11 Column: 1

              if sys.path[0] in (".", ""): del sys.path[0]

import sys, os
from stat import *

def msg(str):
    sys.stderr.write(str + '\n')

def main():

            

Reported by Pylint.

Modules/_decimal/tests/randfloat.py
97 issues
Unused variable 'i'
Error

Line: 20 Column: 13

                      lower = -(-2**53//5**k)
        if lower % 2 == 0:
            lower += 1
        for i in range(10 * TEST_SIZE):
            # Select a random odd n in [2**53/5**k,
            # 2**54/5**k). Then n * 10**k gives a halfway case
            # with small number of significant digits.
            n, e = random.randrange(lower, upper, 2), k


            

Reported by Pylint.

Unused variable 'i'
Error

Line: 56 Column: 9

              
def test_halfway_cases():
    # test halfway cases for the round-half-to-even rule
    for i in range(1000):
        for j in range(TEST_SIZE):
            # bit pattern for a random finite positive (or +0.0) float
            bits = random.randrange(2047*2**52)

            # convert bit pattern to a number of the form m * 2**e

            

Reported by Pylint.

Unused variable 'j'
Error

Line: 57 Column: 13

              def test_halfway_cases():
    # test halfway cases for the round-half-to-even rule
    for i in range(1000):
        for j in range(TEST_SIZE):
            # bit pattern for a random finite positive (or +0.0) float
            bits = random.randrange(2047*2**52)

            # convert bit pattern to a number of the form m * 2**e
            e, m = divmod(bits, 2**52)

            

Reported by Pylint.

Unused variable 'j'
Error

Line: 92 Column: 13

                      (0, -327, 4941),                     # zero
        ]
    for n, e, u in boundaries:
        for j in range(1000):
            for i in range(TEST_SIZE):
                digits = n + random.randrange(-3*u, 3*u)
                exponent = e
                s = '{}e{}'.format(digits, exponent)
                yield s

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 93 Column: 17

                      ]
    for n, e, u in boundaries:
        for j in range(1000):
            for i in range(TEST_SIZE):
                digits = n + random.randrange(-3*u, 3*u)
                exponent = e
                s = '{}e{}'.format(digits, exponent)
                yield s
            n *= 10

            

Reported by Pylint.

Unused variable 'j'
Error

Line: 108 Column: 13

                  # with n
    for exponent in range(-400, -320):
        base = 10**-exponent // 2**1075
        for j in range(TEST_SIZE):
            digits = base + random.randrange(-1000, 1000)
            s = '{}e{}'.format(digits, exponent)
            yield s

def test_bigcomp():

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 116 Column: 13

              def test_bigcomp():
    for ndigs in 5, 10, 14, 15, 16, 17, 18, 19, 20, 40, 41, 50:
        dig10 = 10**ndigs
        for i in range(100 * TEST_SIZE):
            digits = random.randrange(dig10)
            exponent = random.randrange(-400, 400)
            s = '{}e{}'.format(digits, exponent)
            yield s


            

Reported by Pylint.

Unused variable 'i'
Error

Line: 129 Column: 9

              
    # put together random short valid strings
    # \d*[.\d*]?e
    for i in range(1000):
        for j in range(TEST_SIZE):
            s = random.choice(signs)
            intpart_len = random.randrange(5)
            s += ''.join(random.choice(digits) for _ in range(intpart_len))
            if random.choice([True, False]):

            

Reported by Pylint.

Unused variable 'j'
Error

Line: 130 Column: 13

                  # put together random short valid strings
    # \d*[.\d*]?e
    for i in range(1000):
        for j in range(TEST_SIZE):
            s = random.choice(signs)
            intpart_len = random.randrange(5)
            s += ''.join(random.choice(digits) for _ in range(intpart_len))
            if random.choice([True, False]):
                s += '.'

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 233 Column: 9

              ]

def un_randfloat():
    for i in range(1000):
        l = random.choice(TESTCASES[:6])
        yield random.choice(l)
    for v in test_particular:
        yield v


            

Reported by Pylint.

Lib/ctypes/test/test_simplesubclasses.py
97 issues
Unused import set_last_error from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *

class MyInt(c_int):
    def __eq__(self, other):
        if type(other) != MyInt:
            return NotImplementedError
        return self.value == other.value


            

Reported by Pylint.

Unused import BigEndianStructure from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *

class MyInt(c_int):
    def __eq__(self, other):
        if type(other) != MyInt:
            return NotImplementedError
        return self.value == other.value


            

Reported by Pylint.

Unused import LittleEndianStructure from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *

class MyInt(c_int):
    def __eq__(self, other):
        if type(other) != MyInt:
            return NotImplementedError
        return self.value == other.value


            

Reported by Pylint.

Unused import c_char from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *

class MyInt(c_int):
    def __eq__(self, other):
        if type(other) != MyInt:
            return NotImplementedError
        return self.value == other.value


            

Reported by Pylint.

Unused import c_char_p from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *

class MyInt(c_int):
    def __eq__(self, other):
        if type(other) != MyInt:
            return NotImplementedError
        return self.value == other.value


            

Reported by Pylint.

Unused import c_void_p from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *

class MyInt(c_int):
    def __eq__(self, other):
        if type(other) != MyInt:
            return NotImplementedError
        return self.value == other.value


            

Reported by Pylint.

Unused import c_voidp from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *

class MyInt(c_int):
    def __eq__(self, other):
        if type(other) != MyInt:
            return NotImplementedError
        return self.value == other.value


            

Reported by Pylint.

Unused import c_bool from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *

class MyInt(c_int):
    def __eq__(self, other):
        if type(other) != MyInt:
            return NotImplementedError
        return self.value == other.value


            

Reported by Pylint.

Unused import c_wchar_p from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *

class MyInt(c_int):
    def __eq__(self, other):
        if type(other) != MyInt:
            return NotImplementedError
        return self.value == other.value


            

Reported by Pylint.

Unused import c_wchar from wildcard import
Error

Line: 2 Column: 1

              import unittest
from ctypes import *

class MyInt(c_int):
    def __eq__(self, other):
        if type(other) != MyInt:
            return NotImplementedError
        return self.value == other.value


            

Reported by Pylint.

Lib/test/test_tuple.py
97 issues
Sequence index is not an int, slice, or instance with __index__
Error

Line: 25 Column: 13

                      t = ()
        msg = "tuple indices must be integers or slices"
        with self.assertRaisesRegex(TypeError, msg):
            t['a']

    def test_constructors(self):
        super().test_constructors()
        # calling built-in types without argument must return empty
        self.assertEqual(tuple(), ())

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 25 Column: 13

                      t = ()
        msg = "tuple indices must be integers or slices"
        with self.assertRaisesRegex(TypeError, msg):
            t['a']

    def test_constructors(self):
        super().test_constructors()
        # calling built-in types without argument must return empty
        self.assertEqual(tuple(), ())

            

Reported by Pylint.

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Security blacklist

Line: 353
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle

                      for proto in range(pickle.HIGHEST_PROTOCOL + 1):
            itorg = iter(data)
            d = pickle.dumps(itorg, proto)
            it = pickle.loads(d)
            self.assertEqual(type(itorg), type(it))
            self.assertEqual(self.type2test(it), self.type2test(data))

            it = pickle.loads(d)
            next(it)

            

Reported by Bandit.

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Security blacklist

Line: 357
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle

                          self.assertEqual(type(itorg), type(it))
            self.assertEqual(self.type2test(it), self.type2test(data))

            it = pickle.loads(d)
            next(it)
            d = pickle.dumps(it, proto)
            self.assertEqual(self.type2test(it), self.type2test(data)[1:])

    def test_reversed_pickle(self):

            

Reported by Bandit.

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Security blacklist

Line: 367
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle

                      for proto in range(pickle.HIGHEST_PROTOCOL + 1):
            itorg = reversed(data)
            d = pickle.dumps(itorg, proto)
            it = pickle.loads(d)
            self.assertEqual(type(itorg), type(it))
            self.assertEqual(self.type2test(it), self.type2test(reversed(data)))

            it = pickle.loads(d)
            next(it)

            

Reported by Bandit.

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
Security blacklist

Line: 371
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b301-pickle

                          self.assertEqual(type(itorg), type(it))
            self.assertEqual(self.type2test(it), self.type2test(reversed(data)))

            it = pickle.loads(d)
            next(it)
            d = pickle.dumps(it, proto)
            self.assertEqual(self.type2test(it), self.type2test(reversed(data))[1:])

    def test_no_comdat_folding(self):

            

Reported by Bandit.

Expression "[3] + T((1, 2))" is assigned to nothing
Error

Line: 382 Column: 13

                      # function addresses.
        class T(tuple): pass
        with self.assertRaises(TypeError):
            [3,] + T((1,2))

    def test_lexicographic_ordering(self):
        # Issue 21100
        a = self.type2test([1, 2])
        b = self.type2test([1, 2, 0])

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from test import support, seq_tests
import unittest

import gc
import pickle

# For tuple hashes, we normally only run a test to ensure that we get
# the same results across platforms in a handful of cases.  If that's
# so, there's no real point to running more.  Set RUN_ALL_HASH_TESTS to

            

Reported by Pylint.

Consider possible security implications associated with pickle module.
Security blacklist

Line: 5
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b403-import-pickle

              import unittest

import gc
import pickle

# For tuple hashes, we normally only run a test to ensure that we get
# the same results across platforms in a handful of cases.  If that's
# so, there's no real point to running more.  Set RUN_ALL_HASH_TESTS to
# run more anyway.  That's usually of real interest only when analyzing,

            

Reported by Bandit.

Too many public methods (21/20)
Error

Line: 18 Column: 1

              RUN_ALL_HASH_TESTS = False
JUST_SHOW_HASH_RESULTS = False # if RUN_ALL_HASH_TESTS, just display

class TupleTest(seq_tests.CommonTest):
    type2test = tuple

    def test_getitem_error(self):
        t = ()
        msg = "tuple indices must be integers or slices"

            

Reported by Pylint.

Lib/wave.py
97 issues
self._convert is not callable
Error

Line: 246 Column: 20

                      if self._sampwidth != 1 and sys.byteorder == 'big':
            data = audioop.byteswap(data, self._sampwidth)
        if self._convert and data:
            data = self._convert(data)
        self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth)
        return data

    #
    # Internal methods.

            

Reported by Pylint.

self._convert is not callable
Error

Line: 429 Column: 20

                      self._ensure_header_written(len(data))
        nframes = len(data) // (self._sampwidth * self._nchannels)
        if self._convert:
            data = self._convert(data)
        if self._sampwidth != 1 and sys.byteorder == 'big':
            data = audioop.byteswap(data, self._sampwidth)
        self._file.write(data)
        self._datawritten += len(data)
        self._nframeswritten = self._nframeswritten + nframes

            

Reported by Pylint.

Attribute '_data_seek_needed' defined outside __init__
Error

Line: 185 Column: 9

                      return self._file

    def rewind(self):
        self._data_seek_needed = 1
        self._soundpos = 0

    def close(self):
        self._file = None
        file = self._i_opened_the_file

            

Reported by Pylint.

Attribute '_soundpos' defined outside __init__
Error

Line: 186 Column: 9

              
    def rewind(self):
        self._data_seek_needed = 1
        self._soundpos = 0

    def close(self):
        self._file = None
        file = self._i_opened_the_file
        if file:

            

Reported by Pylint.

Attribute '_file' defined outside __init__
Error

Line: 189 Column: 9

                      self._soundpos = 0

    def close(self):
        self._file = None
        file = self._i_opened_the_file
        if file:
            self._i_opened_the_file = None
            file.close()


            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 224 Column: 23

                  def getmarkers(self):
        return None

    def getmark(self, id):
        raise Error('no marks')

    def setpos(self, pos):
        if pos < 0 or pos > self._nframes:
            raise Error('position not in range')

            

Reported by Pylint.

Attribute '_soundpos' defined outside __init__
Error

Line: 230 Column: 9

                  def setpos(self, pos):
        if pos < 0 or pos > self._nframes:
            raise Error('position not in range')
        self._soundpos = pos
        self._data_seek_needed = 1

    def readframes(self, nframes):
        if self._data_seek_needed:
            self._data_chunk.seek(0, 0)

            

Reported by Pylint.

Attribute '_data_seek_needed' defined outside __init__
Error

Line: 231 Column: 9

                      if pos < 0 or pos > self._nframes:
            raise Error('position not in range')
        self._soundpos = pos
        self._data_seek_needed = 1

    def readframes(self, nframes):
        if self._data_seek_needed:
            self._data_chunk.seek(0, 0)
            pos = self._soundpos * self._framesize

            

Reported by Pylint.

Attribute '_data_seek_needed' defined outside __init__
Error

Line: 239 Column: 13

                          pos = self._soundpos * self._framesize
            if pos:
                self._data_chunk.seek(pos, 0)
            self._data_seek_needed = 0
        if nframes == 0:
            return b''
        data = self._data_chunk.read(nframes * self._framesize)
        if self._sampwidth != 1 and sys.byteorder == 'big':
            data = audioop.byteswap(data, self._sampwidth)

            

Reported by Pylint.

Attribute '_soundpos' defined outside __init__
Error

Line: 247 Column: 9

                          data = audioop.byteswap(data, self._sampwidth)
        if self._convert and data:
            data = self._convert(data)
        self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth)
        return data

    #
    # Internal methods.
    #

            

Reported by Pylint.