The following issues were found

Lib/decimal.py
44 issues
Unused import DefaultContext from wildcard import
Error

Line: 3 Column: 5

              
try:
    from _decimal import *
    from _decimal import __doc__
    from _decimal import __version__
    from _decimal import __libmpdec_version__
except ImportError:
    from _pydecimal import *
    from _pydecimal import __doc__

            

Reported by Pylint.

Unused import Decimal from wildcard import
Error

Line: 3 Column: 5

              
try:
    from _decimal import *
    from _decimal import __doc__
    from _decimal import __version__
    from _decimal import __libmpdec_version__
except ImportError:
    from _pydecimal import *
    from _pydecimal import __doc__

            

Reported by Pylint.

Unused import ConversionSyntax from wildcard import
Error

Line: 3 Column: 5

              
try:
    from _decimal import *
    from _decimal import __doc__
    from _decimal import __version__
    from _decimal import __libmpdec_version__
except ImportError:
    from _pydecimal import *
    from _pydecimal import __doc__

            

Reported by Pylint.

Unused import Context from wildcard import
Error

Line: 3 Column: 5

              
try:
    from _decimal import *
    from _decimal import __doc__
    from _decimal import __version__
    from _decimal import __libmpdec_version__
except ImportError:
    from _pydecimal import *
    from _pydecimal import __doc__

            

Reported by Pylint.

Unused import Clamped from wildcard import
Error

Line: 3 Column: 5

              
try:
    from _decimal import *
    from _decimal import __doc__
    from _decimal import __version__
    from _decimal import __libmpdec_version__
except ImportError:
    from _pydecimal import *
    from _pydecimal import __doc__

            

Reported by Pylint.

Unused import BasicContext from wildcard import
Error

Line: 3 Column: 5

              
try:
    from _decimal import *
    from _decimal import __doc__
    from _decimal import __version__
    from _decimal import __libmpdec_version__
except ImportError:
    from _pydecimal import *
    from _pydecimal import __doc__

            

Reported by Pylint.

Wildcard import _decimal
Error

Line: 3 Column: 5

              
try:
    from _decimal import *
    from _decimal import __doc__
    from _decimal import __version__
    from _decimal import __libmpdec_version__
except ImportError:
    from _pydecimal import *
    from _pydecimal import __doc__

            

Reported by Pylint.

Unused import setcontext from wildcard import
Error

Line: 3 Column: 5

              
try:
    from _decimal import *
    from _decimal import __doc__
    from _decimal import __version__
    from _decimal import __libmpdec_version__
except ImportError:
    from _pydecimal import *
    from _pydecimal import __doc__

            

Reported by Pylint.

Unused import localcontext from wildcard import
Error

Line: 3 Column: 5

              
try:
    from _decimal import *
    from _decimal import __doc__
    from _decimal import __version__
    from _decimal import __libmpdec_version__
except ImportError:
    from _pydecimal import *
    from _pydecimal import __doc__

            

Reported by Pylint.

Unused import getcontext from wildcard import
Error

Line: 3 Column: 5

              
try:
    from _decimal import *
    from _decimal import __doc__
    from _decimal import __version__
    from _decimal import __libmpdec_version__
except ImportError:
    from _pydecimal import *
    from _pydecimal import __doc__

            

Reported by Pylint.

Lib/_strptime.py
44 issues
bad operand type for unary -: NoneType
Error

Line: 469 Column: 30

                              gmtoff_remainder_padding = "0" * (6 - len(gmtoff_remainder))
                gmtoff_fraction = int(gmtoff_remainder + gmtoff_remainder_padding)
                if z.startswith("-"):
                    gmtoff = -gmtoff
                    gmtoff_fraction = -gmtoff_fraction
        elif group_key == 'Z':
            # Since -1 is default value only need to worry about setting tz if
            # it can be something other than -1.
            found_zone = found_dict['Z'].lower()

            

Reported by Pylint.

XXX: Does 'Y' need to worry about having less or more than
Error

Line: 201 Column: 2

                          'V': r"(?P<V>5[0-3]|0[1-9]|[1-4]\d|\d)",
            # W is set below by using 'U'
            'y': r"(?P<y>\d\d)",
            #XXX: Does 'Y' need to worry about having less or more than
            #     4 digits?
            'Y': r"(?P<Y>\d\d\d\d)",
            'z': r"(?P<z>[+-]\d\d:?[0-5]\d(:?[0-5]\d(\.\d{1,6})?)?|(?-i:Z))",
            'A': self.__seqToRE(self.locale_time.f_weekday, 'A'),
            'a': self.__seqToRE(self.locale_time.a_weekday, 'a'),

            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 238 Column: 23

                      regex = '(?P<%s>%s' % (directive, regex)
        return '%s)' % regex

    def pattern(self, format):
        """Return regex pattern for the format string.

        Need to make sure that any characters that might be interpreted as
        regex syntax are escaped.


            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 261 Column: 23

                          format = format[directive_index+1:]
        return "%s%s" % (processed_format, format)

    def compile(self, format):
        """Return a compiled re object for the format string."""
        return re_compile(self.pattern(format), IGNORECASE)

_cache_lock = _thread_allocate_lock()
# DO NOT modify _TimeRE_cache or _regex_cache without acquiring the cache lock

            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 309 Column: 28

                  return iso_year, ordinal


def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
    """Return a 2-tuple consisting of a time struct and an int containing
    the number of microseconds based on the input string and the
    format string."""

    for index, arg in enumerate([data_string, format]):

            

Reported by Pylint.

Using the global statement
Error

Line: 319 Column: 5

                          msg = "strptime() argument {} must be str, not {}"
            raise TypeError(msg.format(index, type(arg)))

    global _TimeRE_cache, _regex_cache
    with _cache_lock:
        locale_time = _TimeRE_cache.locale_time
        if (_getlang() != locale_time.lang or
            time.tzname != locale_time.tzname or
            time.daylight != locale_time.daylight):

            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 559 Column: 33

                          hour, minute, second,
            weekday, julian, tz, tzname, gmtoff), fraction, gmtoff_fraction

def _strptime_time(data_string, format="%a %b %d %H:%M:%S %Y"):
    """Return a time struct based on the input string and the
    format string."""
    tt = _strptime(data_string, format)[0]
    return time.struct_time(tt[:time._STRUCT_TM_ITEMS])


            

Reported by Pylint.

Access to a protected member _STRUCT_TM_ITEMS of a client class
Error

Line: 563 Column: 33

                  """Return a time struct based on the input string and the
    format string."""
    tt = _strptime(data_string, format)[0]
    return time.struct_time(tt[:time._STRUCT_TM_ITEMS])

def _strptime_datetime(cls, data_string, format="%a %b %d %H:%M:%S %Y"):
    """Return a class cls instance based on the input string and the
    format string."""
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)

            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 565 Column: 42

                  tt = _strptime(data_string, format)[0]
    return time.struct_time(tt[:time._STRUCT_TM_ITEMS])

def _strptime_datetime(cls, data_string, format="%a %b %d %H:%M:%S %Y"):
    """Return a class cls instance based on the input string and the
    format string."""
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
    tzname, gmtoff = tt[-2:]
    args = tt[:6] + (fraction,)

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 30 Column: 1

                  # Figure out what the current language is set to.
    return locale.getlocale(locale.LC_TIME)

class LocaleTime(object):
    """Stores and handles locale-specific information related to time.

    ATTRIBUTES:
        f_weekday -- full weekday names (7-item list)
        a_weekday -- abbreviated weekday names (7-item list)

            

Reported by Pylint.

Lib/distutils/core.py
44 issues
Unused import DistutilsModuleError from wildcard import
Error

Line: 13 Column: 1

              import sys

from distutils.debug import DEBUG
from distutils.errors import *

# Mainly import these so setup scripts can "from distutils.core import" them.
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand

            

Reported by Pylint.

Unused import LibError from wildcard import
Error

Line: 13 Column: 1

              import sys

from distutils.debug import DEBUG
from distutils.errors import *

# Mainly import these so setup scripts can "from distutils.core import" them.
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand

            

Reported by Pylint.

Unused import DistutilsFileError from wildcard import
Error

Line: 13 Column: 1

              import sys

from distutils.debug import DEBUG
from distutils.errors import *

# Mainly import these so setup scripts can "from distutils.core import" them.
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand

            

Reported by Pylint.

Wildcard import distutils.errors
Error

Line: 13 Column: 1

              import sys

from distutils.debug import DEBUG
from distutils.errors import *

# Mainly import these so setup scripts can "from distutils.core import" them.
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand

            

Reported by Pylint.

Unused import LinkError from wildcard import
Error

Line: 13 Column: 1

              import sys

from distutils.debug import DEBUG
from distutils.errors import *

# Mainly import these so setup scripts can "from distutils.core import" them.
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand

            

Reported by Pylint.

Unused import DistutilsClassError from wildcard import
Error

Line: 13 Column: 1

              import sys

from distutils.debug import DEBUG
from distutils.errors import *

# Mainly import these so setup scripts can "from distutils.core import" them.
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand

            

Reported by Pylint.

Unused import UnknownFileError from wildcard import
Error

Line: 13 Column: 1

              import sys

from distutils.debug import DEBUG
from distutils.errors import *

# Mainly import these so setup scripts can "from distutils.core import" them.
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand

            

Reported by Pylint.

Unused import PreprocessError from wildcard import
Error

Line: 13 Column: 1

              import sys

from distutils.debug import DEBUG
from distutils.errors import *

# Mainly import these so setup scripts can "from distutils.core import" them.
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand

            

Reported by Pylint.

Unused import CompileError from wildcard import
Error

Line: 13 Column: 1

              import sys

from distutils.debug import DEBUG
from distutils.errors import *

# Mainly import these so setup scripts can "from distutils.core import" them.
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand

            

Reported by Pylint.

Unused import DistutilsInternalError from wildcard import
Error

Line: 13 Column: 1

              import sys

from distutils.debug import DEBUG
from distutils.errors import *

# Mainly import these so setup scripts can "from distutils.core import" them.
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.config import PyPIRCCommand

            

Reported by Pylint.

Lib/ctypes/util.py
44 issues
Module 'os' has no 'RTLD_MEMBER' member
Error

Line: 358 Column: 82

                      elif sys.platform.startswith("aix"):
            from ctypes import CDLL
            if sys.maxsize < 2**32:
                print(f"Using CDLL(name, os.RTLD_MEMBER): {CDLL('libc.a(shr.o)', os.RTLD_MEMBER)}")
                print(f"Using cdll.LoadLibrary(): {cdll.LoadLibrary('libc.a(shr.o)')}")
                # librpm.so is only available as 32-bit shared library
                print(find_library("rpm"))
                print(cdll.LoadLibrary("librpm.so"))
            else:

            

Reported by Pylint.

Module 'os' has no 'RTLD_MEMBER' member
Error

Line: 364 Column: 85

                              print(find_library("rpm"))
                print(cdll.LoadLibrary("librpm.so"))
            else:
                print(f"Using CDLL(name, os.RTLD_MEMBER): {CDLL('libc.a(shr_64.o)', os.RTLD_MEMBER)}")
                print(f"Using cdll.LoadLibrary(): {cdll.LoadLibrary('libc.a(shr_64.o)')}")
            print(f"crypt\t:: {find_library('crypt')}")
            print(f"crypt\t:: {cdll.LoadLibrary(find_library('crypt'))}")
            print(f"crypto\t:: {find_library('crypto')}")
            print(f"crypto\t:: {cdll.LoadLibrary(find_library('crypto'))}")

            

Reported by Pylint.

Unused variable 'rest'
Error

Line: 21 Column: 12

                      if i == -1:
            return 6
        i = i + len(prefix)
        s, rest = sys.version[i:].split(" ", 1)
        majorVersion = int(s[:-2]) - 6
        if majorVersion >= 13:
            majorVersion += 1
        minorVersion = int(s[2:3]) / 10.0
        # I don't think paths are affected by minor version in version 6

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 258 Column: 17

                          if not paths:
                return None

            for dir in paths.split(":"):
                libfile = os.path.join(dir, "lib%s.so" % name)
                if os.path.exists(libfile):
                    return libfile

            return None

            

Reported by Pylint.

XXX assuming GLIBC's ldconfig (with option -p)
Error

Line: 285 Column: 3

                              }
            abi_type = mach_map.get(machine, 'libc6')

            # XXX assuming GLIBC's ldconfig (with option -p)
            regex = r'\s+(lib%s\.[^\s]+)\s+\(%s'
            regex = os.fsencode(regex % (re.escape(name), abi_type))
            try:
                with subprocess.Popen(['/sbin/ldconfig', '-p'],
                                      stdin=subprocess.DEVNULL,

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 323 Column: 20

                                  if not _is_elf(file):
                        continue
                    return os.fsdecode(file)
            except Exception:
                pass  # result will be None
            return result

        def find_library(name):
            # See issue #9998

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import os
import shutil
import subprocess
import sys

# find_library(name) returns the pathname of a library, or None.
if os.name == "nt":

    def _get_build_version():

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 3
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              import os
import shutil
import subprocess
import sys

# find_library(name) returns the pathname of a library, or None.
if os.name == "nt":

    def _get_build_version():

            

Reported by Bandit.

Variable name "s" doesn't conform to snake_case naming style
Error

Line: 21 Column: 9

                      if i == -1:
            return 6
        i = i + len(prefix)
        s, rest = sys.version[i:].split(" ", 1)
        majorVersion = int(s[:-2]) - 6
        if majorVersion >= 13:
            majorVersion += 1
        minorVersion = int(s[2:3]) / 10.0
        # I don't think paths are affected by minor version in version 6

            

Reported by Pylint.

Variable name "majorVersion" doesn't conform to snake_case naming style
Error

Line: 22 Column: 9

                          return 6
        i = i + len(prefix)
        s, rest = sys.version[i:].split(" ", 1)
        majorVersion = int(s[:-2]) - 6
        if majorVersion >= 13:
            majorVersion += 1
        minorVersion = int(s[2:3]) / 10.0
        # I don't think paths are affected by minor version in version 6
        if majorVersion == 6:

            

Reported by Pylint.

Doc/includes/turtle-star.py
44 issues
Undefined variable 'color'
Error

Line: 2 Column: 1

              from turtle import *
color('red', 'yellow')
begin_fill()
while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()

            

Reported by Pylint.

Undefined variable 'begin_fill'
Error

Line: 3 Column: 1

              from turtle import *
color('red', 'yellow')
begin_fill()
while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()

            

Reported by Pylint.

Undefined variable 'forward'
Error

Line: 5 Column: 5

              color('red', 'yellow')
begin_fill()
while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()
done()

            

Reported by Pylint.

Undefined variable 'left'
Error

Line: 6 Column: 5

              begin_fill()
while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()
done()

            

Reported by Pylint.

Undefined variable 'pos'
Error

Line: 7 Column: 12

              while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()
done()

            

Reported by Pylint.

Undefined variable 'end_fill'
Error

Line: 9 Column: 1

                  left(170)
    if abs(pos()) < 1:
        break
end_fill()
done()

            

Reported by Pylint.

Unused import write_docstringdict from wildcard import
Error

Line: 1 Column: 1

              from turtle import *
color('red', 'yellow')
begin_fill()
while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()

            

Reported by Pylint.

Unused import read_docstrings from wildcard import
Error

Line: 1 Column: 1

              from turtle import *
color('red', 'yellow')
begin_fill()
while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()

            

Reported by Pylint.

Unused import getmethparlist from wildcard import
Error

Line: 1 Column: 1

              from turtle import *
color('red', 'yellow')
begin_fill()
while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()

            

Reported by Pylint.

Unused import switchpen from wildcard import
Error

Line: 1 Column: 1

              from turtle import *
color('red', 'yellow')
begin_fill()
while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()

            

Reported by Pylint.

Lib/lib2to3/patcomp.py
44 issues
Attempted relative import beyond top-level package
Error

Line: 17 Column: 1

              import io

# Fairly local imports
from .pgen2 import driver, literals, token, tokenize, parse, grammar

# Really local imports
from . import pytree
from . import pygram


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 20 Column: 1

              from .pgen2 import driver, literals, token, tokenize, parse, grammar

# Really local imports
from . import pytree
from . import pygram


class PatternSyntaxError(Exception):
    pass

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 21 Column: 1

              
# Really local imports
from . import pytree
from . import pygram


class PatternSyntaxError(Exception):
    pass


            

Reported by Pylint.

Redefining built-in 'input'
Error

Line: 28 Column: 22

                  pass


def tokenize_wrapper(input):
    """Tokenizes a string suppressing significant whitespace."""
    skip = {token.NEWLINE, token.INDENT, token.DEDENT}
    tokens = tokenize.generate_tokens(io.StringIO(input).readline)
    for quintuple in tokens:
        type, value, start, end, line_text = quintuple

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 33 Column: 9

                  skip = {token.NEWLINE, token.INDENT, token.DEDENT}
    tokens = tokenize.generate_tokens(io.StringIO(input).readline)
    for quintuple in tokens:
        type, value, start, end, line_text = quintuple
        if type not in skip:
            yield quintuple


class PatternCompiler(object):

            

Reported by Pylint.

Unused variable 'start'
Error

Line: 33 Column: 22

                  skip = {token.NEWLINE, token.INDENT, token.DEDENT}
    tokens = tokenize.generate_tokens(io.StringIO(input).readline)
    for quintuple in tokens:
        type, value, start, end, line_text = quintuple
        if type not in skip:
            yield quintuple


class PatternCompiler(object):

            

Reported by Pylint.

Unused variable 'value'
Error

Line: 33 Column: 15

                  skip = {token.NEWLINE, token.INDENT, token.DEDENT}
    tokens = tokenize.generate_tokens(io.StringIO(input).readline)
    for quintuple in tokens:
        type, value, start, end, line_text = quintuple
        if type not in skip:
            yield quintuple


class PatternCompiler(object):

            

Reported by Pylint.

Unused variable 'line_text'
Error

Line: 33 Column: 34

                  skip = {token.NEWLINE, token.INDENT, token.DEDENT}
    tokens = tokenize.generate_tokens(io.StringIO(input).readline)
    for quintuple in tokens:
        type, value, start, end, line_text = quintuple
        if type not in skip:
            yield quintuple


class PatternCompiler(object):

            

Reported by Pylint.

Unused variable 'end'
Error

Line: 33 Column: 29

                  skip = {token.NEWLINE, token.INDENT, token.DEDENT}
    tokens = tokenize.generate_tokens(io.StringIO(input).readline)
    for quintuple in tokens:
        type, value, start, end, line_text = quintuple
        if type not in skip:
            yield quintuple


class PatternCompiler(object):

            

Reported by Pylint.

Redefining built-in 'input'
Error

Line: 55 Column: 31

                      self.pysyms = pygram.python_symbols
        self.driver = driver.Driver(self.grammar, convert=pattern_convert)

    def compile_pattern(self, input, debug=False, with_tree=False):
        """Compiles a pattern string to a nested pytree.*Pattern object."""
        tokens = tokenize_wrapper(input)
        try:
            root = self.driver.parse_tokens(tokens, debug=debug)
        except parse.ParseError as e:

            

Reported by Pylint.

Modules/clinic/_codecsmodule.c.h
44 issues
strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 56 Column: 9 CWE codes: 126

                  if (encoding == NULL) {
        goto exit;
    }
    if (strlen(encoding) != (size_t)encoding_length) {
        PyErr_SetString(PyExc_ValueError, "embedded null character");
        goto exit;
    }
    return_value = _codecs_lookup_impl(module, encoding);


            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 115 Column: 13 CWE codes: 126

                      if (encoding == NULL) {
            goto exit;
        }
        if (strlen(encoding) != (size_t)encoding_length) {
            PyErr_SetString(PyExc_ValueError, "embedded null character");
            goto exit;
        }
        if (!--noptargs) {
            goto skip_optional_pos;

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 132 Column: 9 CWE codes: 126

                  if (errors == NULL) {
        goto exit;
    }
    if (strlen(errors) != (size_t)errors_length) {
        PyErr_SetString(PyExc_ValueError, "embedded null character");
        goto exit;
    }
skip_optional_pos:
    return_value = _codecs_encode_impl(module, obj, encoding, errors);

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 192 Column: 13 CWE codes: 126

                      if (encoding == NULL) {
            goto exit;
        }
        if (strlen(encoding) != (size_t)encoding_length) {
            PyErr_SetString(PyExc_ValueError, "embedded null character");
            goto exit;
        }
        if (!--noptargs) {
            goto skip_optional_pos;

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 209 Column: 9 CWE codes: 126

                  if (errors == NULL) {
        goto exit;
    }
    if (strlen(errors) != (size_t)errors_length) {
        PyErr_SetString(PyExc_ValueError, "embedded null character");
        goto exit;
    }
skip_optional_pos:
    return_value = _codecs_decode_impl(module, obj, encoding, errors);

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 271 Column: 13 CWE codes: 126

                      if (errors == NULL) {
            goto exit;
        }
        if (strlen(errors) != (size_t)errors_length) {
            PyErr_SetString(PyExc_ValueError, "embedded null character");
            goto exit;
        }
    }
    else {

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 331 Column: 13 CWE codes: 126

                      if (errors == NULL) {
            goto exit;
        }
        if (strlen(errors) != (size_t)errors_length) {
            PyErr_SetString(PyExc_ValueError, "embedded null character");
            goto exit;
        }
    }
    else {

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 389 Column: 13 CWE codes: 126

                      if (errors == NULL) {
            goto exit;
        }
        if (strlen(errors) != (size_t)errors_length) {
            PyErr_SetString(PyExc_ValueError, "embedded null character");
            goto exit;
        }
    }
    else {

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 459 Column: 13 CWE codes: 126

                      if (errors == NULL) {
            goto exit;
        }
        if (strlen(errors) != (size_t)errors_length) {
            PyErr_SetString(PyExc_ValueError, "embedded null character");
            goto exit;
        }
    }
    else {

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 529 Column: 13 CWE codes: 126

                      if (errors == NULL) {
            goto exit;
        }
        if (strlen(errors) != (size_t)errors_length) {
            PyErr_SetString(PyExc_ValueError, "embedded null character");
            goto exit;
        }
    }
    else {

            

Reported by FlawFinder.

Lib/test/test_uu.py
44 issues
Instance of 'BufferedWriter' has no 'getvalue' member
Error

Line: 46 Column: 16

              
    def getvalue(self):
        self.flush()
        return self.buffer.getvalue().decode(self._encoding, self._errors)


def encodedtextwrapped(mode, filename, backtick=False):
    if backtick:
        res = (bytes("begin %03o %s\n" % (mode, filename), "ascii") +

            

Reported by Pylint.

Too many positional arguments for function call
Error

Line: 74 Column: 13

                      uu.encode(inp, out, "t1", backtick=True)
        self.assertEqual(out.getvalue(), encodedtextwrapped(0o666, "t1", True))
        with self.assertRaises(TypeError):
            uu.encode(inp, out, "t1", 0o644, True)

    def test_decode(self):
        for backtick in True, False:
            inp = io.BytesIO(encodedtextwrapped(0o666, "t1", backtick=backtick))
            out = io.BytesIO()

            

Reported by Pylint.

XXX This is really slow, but fully functional
Error

Line: 28 Column: 3

                  Can be a used as a drop-in replacement for sys.stdin and sys.stdout.
    """

    # XXX This is really slow, but fully functional

    def __init__(self, initial_value="", encoding="utf-8",
                 errors="strict", newline="\n"):
        super(FakeIO, self).__init__(io.BytesIO(),
                                     encoding=encoding,

            

Reported by Pylint.

Redefining name 'plaintext' from outer scope (line 15)
Error

Line: 125 Column: 9

                          b"\x60\n"
            b"end\n"
        )
        plaintext = b"\x33"  # 00110011

        for encodedtext in encodedtext1, encodedtext2:
            with self.subTest("uu.decode()"):
                inp = io.BytesIO(encodedtext)
                out = io.BytesIO()

            

Reported by Pylint.

Redefining name 'encodedtext' from outer scope (line 17)
Error

Line: 127 Column: 13

                      )
        plaintext = b"\x33"  # 00110011

        for encodedtext in encodedtext1, encodedtext2:
            with self.subTest("uu.decode()"):
                inp = io.BytesIO(encodedtext)
                out = io.BytesIO()
                uu.decode(inp, out, quiet=True)
                self.assertEqual(out.getvalue(), plaintext)

            

Reported by Pylint.

XXX is there an xp way to verify the mode?
Error

Line: 211 Column: 3

                      with open(self.tmpout, 'rb') as f:
            s = f.read()
        self.assertEqual(s, plaintext)
        # XXX is there an xp way to verify the mode?

    def test_decode_filename(self):
        with open(self.tmpin, 'wb') as f:
            f.write(encodedtextwrapped(0o644, self.tmpout))


            

Reported by Pylint.

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

Line: 15 Column: 1

              import uu
import io

plaintext = b"The symbols on top of your keyboard are !@#$%^&*()_+|~\n"

encodedtext = b"""\
M5&AE('-Y;6)O;',@;VX@=&]P(&]F('EO=7(@:V5Y8F]A<F0@87)E("% (R0E
*7B8J*"E?*WQ^"@  """


            

Reported by Pylint.

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

Line: 17 Column: 1

              
plaintext = b"The symbols on top of your keyboard are !@#$%^&*()_+|~\n"

encodedtext = b"""\
M5&AE('-Y;6)O;',@;VX@=&]P(&]F('EO=7(@:V5Y8F]A<F0@87)E("% (R0E
*7B8J*"E?*WQ^"@  """

# Stolen from io.py
class FakeIO(io.TextIOWrapper):

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 32 Column: 9

              
    def __init__(self, initial_value="", encoding="utf-8",
                 errors="strict", newline="\n"):
        super(FakeIO, self).__init__(io.BytesIO(),
                                     encoding=encoding,
                                     errors=errors,
                                     newline=newline)
        self._encoding = encoding
        self._errors = errors

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 44 Column: 5

                          self.write(initial_value)
            self.seek(0)

    def getvalue(self):
        self.flush()
        return self.buffer.getvalue().decode(self._encoding, self._errors)


def encodedtextwrapped(mode, filename, backtick=False):

            

Reported by Pylint.

Lib/test/test_structseq.py
44 issues
Class 'struct_time' has no '__match_args__' member
Error

Line: 128 Column: 26

                  def test_match_args(self):
        expected_args = ('tm_year', 'tm_mon', 'tm_mday', 'tm_hour', 'tm_min',
                         'tm_sec', 'tm_wday', 'tm_yday', 'tm_isdst')
        self.assertEqual(time.struct_time.__match_args__, expected_args)

    def test_match_args_with_unnamed_fields(self):
        expected_args = ('st_mode', 'st_ino', 'st_dev', 'st_nlink', 'st_uid',
                         'st_gid', 'st_size')
        self.assertEqual(os.stat_result.n_unnamed_fields, 3)

            

Reported by Pylint.

Access to a protected member _STRUCT_TM_ITEMS of a client class
Error

Line: 82 Column: 38

                      t = time.gmtime()
        self.assertEqual(len(t), t.n_sequence_fields)
        self.assertEqual(t.n_unnamed_fields, 0)
        self.assertEqual(t.n_fields, time._STRUCT_TM_ITEMS)

    def test_constructor(self):
        t = time.struct_time

        self.assertRaises(TypeError, t)

            

Reported by Pylint.

Unused variable 'x'
Error

Line: 111 Column: 9

              
    def test_reduce(self):
        t = time.gmtime()
        x = t.__reduce__()

    def test_extended_getslice(self):
        # Test extended slicing by comparing with list slicing.
        t = time.gmtime()
        L = list(t)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import os
import time
import unittest


class StructSeqTest(unittest.TestCase):

    def test_tuple(self):
        t = time.gmtime()

            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              import unittest


class StructSeqTest(unittest.TestCase):

    def test_tuple(self):
        t = time.gmtime()
        self.assertIsInstance(t, tuple)
        astuple = tuple(t)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 5

              
class StructSeqTest(unittest.TestCase):

    def test_tuple(self):
        t = time.gmtime()
        self.assertIsInstance(t, tuple)
        astuple = tuple(t)
        self.assertEqual(len(t), len(astuple))
        self.assertEqual(t, astuple)

            

Reported by Pylint.

Variable name "t" doesn't conform to snake_case naming style
Error

Line: 9 Column: 9

              class StructSeqTest(unittest.TestCase):

    def test_tuple(self):
        t = time.gmtime()
        self.assertIsInstance(t, tuple)
        astuple = tuple(t)
        self.assertEqual(len(t), len(astuple))
        self.assertEqual(t, astuple)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 30 Column: 5

                      for i in range(-len(t), len(t)-1):
            self.assertEqual(t[i], astuple[i])

    def test_repr(self):
        t = time.gmtime()
        self.assertTrue(repr(t))
        t = time.gmtime(0)
        self.assertEqual(repr(t),
            "time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, "

            

Reported by Pylint.

Variable name "t" doesn't conform to snake_case naming style
Error

Line: 31 Column: 9

                          self.assertEqual(t[i], astuple[i])

    def test_repr(self):
        t = time.gmtime()
        self.assertTrue(repr(t))
        t = time.gmtime(0)
        self.assertEqual(repr(t),
            "time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, "
            "tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)")

            

Reported by Pylint.

Variable name "t" doesn't conform to snake_case naming style
Error

Line: 33 Column: 9

                  def test_repr(self):
        t = time.gmtime()
        self.assertTrue(repr(t))
        t = time.gmtime(0)
        self.assertEqual(repr(t),
            "time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, "
            "tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)")
        # os.stat() gives a complicated struct sequence.
        st = os.stat(__file__)

            

Reported by Pylint.

Modules/_decimal/tests/bignum.py
44 issues
Unable to import 'gmpy'
Error

Line: 9 Column: 1

              
import sys
from decimal import *
from gmpy import mpz


_PyHASH_MODULUS = sys.hash_info.modulus
# hash values to use for positive and negative infinities, and nans
_PyHASH_INF = sys.hash_info.inf

            

Reported by Pylint.

Wildcard import decimal
Error

Line: 8 Column: 1

              #

import sys
from decimal import *
from gmpy import mpz


_PyHASH_MODULUS = sys.hash_info.modulus
# hash values to use for positive and negative infinities, and nans

            

Reported by Pylint.

Unused import setcontext from wildcard import
Error

Line: 8 Column: 1

              #

import sys
from decimal import *
from gmpy import mpz


_PyHASH_MODULUS = sys.hash_info.modulus
# hash values to use for positive and negative infinities, and nans

            

Reported by Pylint.

Unused import ROUND_HALF_DOWN from wildcard import
Error

Line: 8 Column: 1

              #

import sys
from decimal import *
from gmpy import mpz


_PyHASH_MODULUS = sys.hash_info.modulus
# hash values to use for positive and negative infinities, and nans

            

Reported by Pylint.

Unused import ROUND_FLOOR from wildcard import
Error

Line: 8 Column: 1

              #

import sys
from decimal import *
from gmpy import mpz


_PyHASH_MODULUS = sys.hash_info.modulus
# hash values to use for positive and negative infinities, and nans

            

Reported by Pylint.

Unused import ROUND_DOWN from wildcard import
Error

Line: 8 Column: 1

              #

import sys
from decimal import *
from gmpy import mpz


_PyHASH_MODULUS = sys.hash_info.modulus
# hash values to use for positive and negative infinities, and nans

            

Reported by Pylint.

Unused import ROUND_CEILING from wildcard import
Error

Line: 8 Column: 1

              #

import sys
from decimal import *
from gmpy import mpz


_PyHASH_MODULUS = sys.hash_info.modulus
# hash values to use for positive and negative infinities, and nans

            

Reported by Pylint.

Unused import ROUND_05UP from wildcard import
Error

Line: 8 Column: 1

              #

import sys
from decimal import *
from gmpy import mpz


_PyHASH_MODULUS = sys.hash_info.modulus
# hash values to use for positive and negative infinities, and nans

            

Reported by Pylint.

Unused import Overflow from wildcard import
Error

Line: 8 Column: 1

              #

import sys
from decimal import *
from gmpy import mpz


_PyHASH_MODULUS = sys.hash_info.modulus
# hash values to use for positive and negative infinities, and nans

            

Reported by Pylint.

Unused import MIN_ETINY from wildcard import
Error

Line: 8 Column: 1

              #

import sys
from decimal import *
from gmpy import mpz


_PyHASH_MODULUS = sys.hash_info.modulus
# hash values to use for positive and negative infinities, and nans

            

Reported by Pylint.