The following issues were found

Lib/asyncio/protocols.py
3 issues
Argument name "fd" doesn't conform to snake_case naming style
Error

Line: 186 Column: 5

              
    __slots__ = ()

    def pipe_data_received(self, fd, data):
        """Called when the subprocess writes data into stdout/stderr pipe.

        fd is int file descriptor.
        data is bytes object.
        """

            

Reported by Pylint.

Argument name "fd" doesn't conform to snake_case naming style
Error

Line: 193 Column: 5

                      data is bytes object.
        """

    def pipe_connection_lost(self, fd, exc):
        """Called when a file descriptor associated with the child process is
        closed.

        fd is the int file descriptor that was closed.
        """

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 212 Column: 9

                      if not buf_len:
            raise RuntimeError('get_buffer() returned an empty buffer')

        if buf_len >= data_len:
            buf[:data_len] = data
            proto.buffer_updated(data_len)
            return
        else:
            buf[:buf_len] = data[:buf_len]

            

Reported by Pylint.

Lib/_compat_pickle.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              # This module is used to map the old Python 2 names to the new names used in
# Python 3 for the pickle module.  This needed to make pickle streams
# generated with Python 2 loadable by Python 3.

# This is a copy of lib2to3.fixes.fix_imports.MAPPING.  We cannot import
# lib2to3 and use the mapping defined there, because lib2to3 uses pickle.
# Thus, this could cause the module to be imported recursively.
IMPORT_MAPPING = {
    '__builtin__' : 'builtins',

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 166
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
# Same, but for 3.x to 2.x
REVERSE_IMPORT_MAPPING = dict((v, k) for (k, v) in IMPORT_MAPPING.items())
assert len(REVERSE_IMPORT_MAPPING) == len(IMPORT_MAPPING)
REVERSE_NAME_MAPPING = dict((v, k) for (k, v) in NAME_MAPPING.items())
assert len(REVERSE_NAME_MAPPING) == len(NAME_MAPPING)

# Non-mutual mappings.


            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 168
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              REVERSE_IMPORT_MAPPING = dict((v, k) for (k, v) in IMPORT_MAPPING.items())
assert len(REVERSE_IMPORT_MAPPING) == len(IMPORT_MAPPING)
REVERSE_NAME_MAPPING = dict((v, k) for (k, v) in NAME_MAPPING.items())
assert len(REVERSE_NAME_MAPPING) == len(NAME_MAPPING)

# Non-mutual mappings.

IMPORT_MAPPING.update({
    'cPickle': 'pickle',

            

Reported by Bandit.

Doc/includes/sqlite3/collation_reverse.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              import sqlite3

def collate_reverse(string1, string2):
    if string1 == string2:
        return 0
    elif string1 < string2:
        return 1
    else:
        return -1

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 3 Column: 1

              import sqlite3

def collate_reverse(string1, string2):
    if string1 == string2:
        return 0
    elif string1 < string2:
        return 1
    else:
        return -1

            

Reported by Pylint.

Unnecessary "elif" after "return"
Error

Line: 4 Column: 5

              import sqlite3

def collate_reverse(string1, string2):
    if string1 == string2:
        return 0
    elif string1 < string2:
        return 1
    else:
        return -1

            

Reported by Pylint.

Include/datetime.h
3 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 74 Column: 14 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

               */
#define _PyDateTime_TIMEHEAD    \
    _PyTZINFO_HEAD              \
    unsigned char data[_PyDateTime_TIME_DATASIZE];

typedef struct
{
    _PyDateTime_TIMEHEAD
} _PyDateTime_BaseTime;         /* hastzinfo false */

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 97 Column: 14 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              typedef struct
{
    _PyTZINFO_HEAD
    unsigned char data[_PyDateTime_DATE_DATASIZE];
} PyDateTime_Date;

#define _PyDateTime_DATETIMEHEAD        \
    _PyTZINFO_HEAD                      \
    unsigned char data[_PyDateTime_DATETIME_DATASIZE];

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 102 Column: 14 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              
#define _PyDateTime_DATETIMEHEAD        \
    _PyTZINFO_HEAD                      \
    unsigned char data[_PyDateTime_DATETIME_DATASIZE];

typedef struct
{
    _PyDateTime_DATETIMEHEAD
} _PyDateTime_BaseDateTime;     /* hastzinfo false */

            

Reported by FlawFinder.

Lib/asyncio/mixins.py
3 issues
Attempted relative import beyond top-level package
Error

Line: 4 Column: 1

              """Event loop mixins."""

import threading
from . import events

_global_lock = threading.Lock()

# Used as a sentinel for loop parameter
_marker = object()

            

Reported by Pylint.

Access to a protected member _get_running_loop of a client class
Error

Line: 23 Column: 16

                          )

    def _get_loop(self):
        loop = events._get_running_loop()

        if self._loop is None:
            with _global_lock:
                if self._loop is None:
                    self._loop = loop

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 12 Column: 1

              _marker = object()


class _LoopBoundMixin:
    _loop = None

    def __init__(self, *, loop=_marker):
        if loop is not _marker:
            raise TypeError(

            

Reported by Pylint.

Lib/distutils/tests/test_log.py
3 issues
Missing class docstring
Error

Line: 10 Column: 1

              
from distutils import log

class TestLog(unittest.TestCase):
    def test_non_ascii(self):
        # Issues #8663, #34421: test that non-encodable text is escaped with
        # backslashreplace error handler and encodable non-ASCII text is
        # output as is.
        for errors in ('strict', 'backslashreplace', 'surrogateescape',

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 5

              from distutils import log

class TestLog(unittest.TestCase):
    def test_non_ascii(self):
        # Issues #8663, #34421: test that non-encodable text is escaped with
        # backslashreplace error handler and encodable non-ASCII text is
        # output as is.
        for errors in ('strict', 'backslashreplace', 'surrogateescape',
                       'replace', 'ignore'):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 42 Column: 1

                                      'Fαtal\trrr' if errors == 'ignore' else
                        'Fαtal\t\\xc8rr\\u014dr')

def test_suite():
    return unittest.makeSuite(TestLog)

if __name__ == "__main__":
    run_unittest(test_suite())

            

Reported by Pylint.

Lib/distutils/command/bdist_msi.py
3 issues
expected an indented block (<unknown>, line 353)
Error

Line: 353 Column: 26

                          target_dir_prop = "TARGETDIR" + ver
            exe_prop = "PYTHON" + ver
            if msilib.Win64:
                # type: msidbLocatorTypeRawValue + msidbLocatorType64bit
                Type = 2+16
            else:
                Type = 2
            add_data(self.db, "RegLocator",
                    [(machine_reg, 2, install_path, None, Type),

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 207
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                          # version.
            target_version = self.target_version
            if not target_version:
                assert self.skip_build, "Should have already checked this"
                target_version = '%d.%d' % sys.version_info[:2]
            plat_specifier = ".%s-%s" % (self.plat_name, target_version)
            build = self.get_finalized_command('build')
            build.build_lib = os.path.join(build.build_base,
                                           'lib' + plat_specifier)

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 381
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                          add_data(self.db, "Condition",
                    [("Python" + ver, 0, "NOT TARGETDIR" + ver)])
            start += 4
            assert start < 500

    def add_scripts(self):
        if self.install_script:
            start = 6800
            for ver in self.versions + [self.other_version]:

            

Reported by Bandit.

Lib/importlib/_legacy.py
3 issues
Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              
from typing import Union, Iterable, ContextManager, BinaryIO, TextIO

from . import _common

Package = Union[types.ModuleType, str]
Resource = Union[str, os.PathLike]



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import os
import pathlib
import types

from typing import Union, Iterable, ContextManager, BinaryIO, TextIO

from . import _common

Package = Union[types.ModuleType, str]

            

Reported by Pylint.

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

Line: 46 Column: 60

                  The decoding-related arguments have the same semantics as those of
    bytes.decode().
    """
    with open_text(package, resource, encoding, errors) as fp:
        return fp.read()


def contents(package: Package) -> Iterable[str]:
    """Return an iterable of entries in `package`.

            

Reported by Pylint.

Lib/__future__.py
2 issues
Method name "getOptionalRelease" doesn't conform to snake_case naming style
Error

Line: 88 Column: 5

                      self.mandatory = mandatoryRelease
        self.compiler_flag = compiler_flag

    def getOptionalRelease(self):
        """Return first release in which this feature was recognized.

        This is a 5-tuple, of the same form as sys.version_info.
        """
        return self.optional

            

Reported by Pylint.

Method name "getMandatoryRelease" doesn't conform to snake_case naming style
Error

Line: 95 Column: 5

                      """
        return self.optional

    def getMandatoryRelease(self):
        """Return release in which this feature will become mandatory.

        This is a 5-tuple, of the same form as sys.version_info, or, if
        the feature was dropped, is None.
        """

            

Reported by Pylint.

Lib/asyncio/threads.py
2 issues
Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              import functools
import contextvars

from . import events


__all__ = "to_thread",



            

Reported by Pylint.

Disallow trailing comma tuple
Error

Line: 9 Column: 1

              from . import events


__all__ = "to_thread",


async def to_thread(func, /, *args, **kwargs):
    """Asynchronously run function *func* in a separate thread.


            

Reported by Pylint.