The following issues were found
Lib/test/final_a.py
4 issues
Line: 8
Column: 1
import shutil
import test.final_b
x = 'a'
class C:
def __del__(self):
# Inspect module globals and builtins
print("x =", x)
Reported by Pylint.
Line: 10
Column: 1
x = 'a'
class C:
def __del__(self):
# Inspect module globals and builtins
print("x =", x)
print("final_b.x =", test.final_b.x)
print("shutil.rmtree =", getattr(shutil.rmtree, '__name__', None))
Reported by Pylint.
Line: 10
Column: 1
x = 'a'
class C:
def __del__(self):
# Inspect module globals and builtins
print("x =", x)
print("final_b.x =", test.final_b.x)
print("shutil.rmtree =", getattr(shutil.rmtree, '__name__', None))
Reported by Pylint.
Line: 10
Column: 1
x = 'a'
class C:
def __del__(self):
# Inspect module globals and builtins
print("x =", x)
print("final_b.x =", test.final_b.x)
print("shutil.rmtree =", getattr(shutil.rmtree, '__name__', None))
Reported by Pylint.
Lib/lib2to3/tests/data/fixers/myfixes/fix_preorder.py
4 issues
Line: 3
Column: 1
from lib2to3.fixer_base import BaseFix
class FixPreorder(BaseFix):
order = "pre"
def match(self, node): return False
Reported by Pylint.
Line: 1
Column: 1
from lib2to3.fixer_base import BaseFix
class FixPreorder(BaseFix):
order = "pre"
def match(self, node): return False
Reported by Pylint.
Line: 3
Column: 1
from lib2to3.fixer_base import BaseFix
class FixPreorder(BaseFix):
order = "pre"
def match(self, node): return False
Reported by Pylint.
Line: 6
Column: 28
class FixPreorder(BaseFix):
order = "pre"
def match(self, node): return False
Reported by Pylint.
Lib/lib2to3/tests/data/fixers/myfixes/fix_last.py
4 issues
Line: 3
Column: 1
from lib2to3.fixer_base import BaseFix
class FixLast(BaseFix):
run_order = 10
def match(self, node): return False
Reported by Pylint.
Line: 1
Column: 1
from lib2to3.fixer_base import BaseFix
class FixLast(BaseFix):
run_order = 10
def match(self, node): return False
Reported by Pylint.
Line: 3
Column: 1
from lib2to3.fixer_base import BaseFix
class FixLast(BaseFix):
run_order = 10
def match(self, node): return False
Reported by Pylint.
Line: 7
Column: 28
run_order = 10
def match(self, node): return False
Reported by Pylint.
Lib/lib2to3/tests/data/fixers/myfixes/fix_first.py
4 issues
Line: 3
Column: 1
from lib2to3.fixer_base import BaseFix
class FixFirst(BaseFix):
run_order = 1
def match(self, node): return False
Reported by Pylint.
Line: 1
Column: 1
from lib2to3.fixer_base import BaseFix
class FixFirst(BaseFix):
run_order = 1
def match(self, node): return False
Reported by Pylint.
Line: 3
Column: 1
from lib2to3.fixer_base import BaseFix
class FixFirst(BaseFix):
run_order = 1
def match(self, node): return False
Reported by Pylint.
Line: 6
Column: 28
class FixFirst(BaseFix):
run_order = 1
def match(self, node): return False
Reported by Pylint.
Lib/test/doctest_aliases.py
4 issues
Line: 1
Column: 1
# Used by test_doctest.py.
class TwoNames:
'''f() and g() are two names for the same method'''
def f(self):
'''
>>> print(TwoNames().f())
f
Reported by Pylint.
Line: 3
Column: 1
# Used by test_doctest.py.
class TwoNames:
'''f() and g() are two names for the same method'''
def f(self):
'''
>>> print(TwoNames().f())
f
Reported by Pylint.
Line: 6
Column: 5
class TwoNames:
'''f() and g() are two names for the same method'''
def f(self):
'''
>>> print(TwoNames().f())
f
'''
return 'f'
Reported by Pylint.
Line: 6
Column: 5
class TwoNames:
'''f() and g() are two names for the same method'''
def f(self):
'''
>>> print(TwoNames().f())
f
'''
return 'f'
Reported by Pylint.
Lib/test/test_openpty.py
4 issues
Line: 1
Column: 1
# Test to see if openpty works. (But don't worry if it isn't available.)
import os, unittest
if not hasattr(os, "openpty"):
raise unittest.SkipTest("os.openpty() not available.")
class OpenptyTest(unittest.TestCase):
Reported by Pylint.
Line: 3
Column: 1
# Test to see if openpty works. (But don't worry if it isn't available.)
import os, unittest
if not hasattr(os, "openpty"):
raise unittest.SkipTest("os.openpty() not available.")
class OpenptyTest(unittest.TestCase):
Reported by Pylint.
Line: 9
Column: 1
raise unittest.SkipTest("os.openpty() not available.")
class OpenptyTest(unittest.TestCase):
def test(self):
master, slave = os.openpty()
self.addCleanup(os.close, master)
self.addCleanup(os.close, slave)
if not os.isatty(slave):
Reported by Pylint.
Line: 10
Column: 5
class OpenptyTest(unittest.TestCase):
def test(self):
master, slave = os.openpty()
self.addCleanup(os.close, master)
self.addCleanup(os.close, slave)
if not os.isatty(slave):
self.fail("Slave-end of pty is not a terminal.")
Reported by Pylint.
Lib/lib2to3/tests/__main__.py
4 issues
Line: 1
Column: 1
from . import load_tests
import unittest
unittest.main()
Reported by Pylint.
Line: 1
Column: 1
from . import load_tests
import unittest
unittest.main()
Reported by Pylint.
Line: 1
Column: 1
from . import load_tests
import unittest
unittest.main()
Reported by Pylint.
Line: 2
Column: 1
from . import load_tests
import unittest
unittest.main()
Reported by Pylint.
Lib/unittest/test/__init__.py
4 issues
Line: 10
Column: 5
loader = unittest.defaultTestLoader
def suite():
suite = unittest.TestSuite()
for fn in os.listdir(here):
if fn.startswith("test") and fn.endswith(".py"):
modname = "unittest.test." + fn[:-3]
__import__(modname)
module = sys.modules[modname]
Reported by Pylint.
Line: 1
Column: 1
import os
import sys
import unittest
here = os.path.dirname(__file__)
loader = unittest.defaultTestLoader
def suite():
Reported by Pylint.
Line: 9
Column: 1
here = os.path.dirname(__file__)
loader = unittest.defaultTestLoader
def suite():
suite = unittest.TestSuite()
for fn in os.listdir(here):
if fn.startswith("test") and fn.endswith(".py"):
modname = "unittest.test." + fn[:-3]
__import__(modname)
Reported by Pylint.
Line: 11
Column: 9
def suite():
suite = unittest.TestSuite()
for fn in os.listdir(here):
if fn.startswith("test") and fn.endswith(".py"):
modname = "unittest.test." + fn[:-3]
__import__(modname)
module = sys.modules[modname]
suite.addTest(loader.loadTestsFromModule(module))
Reported by Pylint.
PC/pyshellext.cpp
4 issues
Line: 592
return S_OK;
}
STDAPI_(BOOL) DllMain(_In_opt_ HINSTANCE hinst, DWORD reason, _In_opt_ void*) {
if (reason == DLL_PROCESS_ATTACH) {
hModule = hinst;
cfDropDescription = RegisterClipboardFormat(CFSTR_DROPDESCRIPTION);
if (!cfDropDescription) {
Reported by Cppcheck.
Line: 378
Column: 13
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
if (SUCCEEDED(GetArguments(pDataObj, &args))) {
OutputDebugString(args);
ShellExecute(NULL, NULL, target, args, target_dir, SW_NORMAL);
CoTaskMemFree((LPVOID)args);
} else {
OutputDebugString(L"PyShellExt::Drop - failed to get launch arguments");
}
Reported by FlawFinder.
Line: 283
Column: 36
CWE codes:
120
if (temp) {
hr = FilenameListCchCopyA(temp, 32767, files, " ");
if (SUCCEEDED(hr)) {
int wlen = MultiByteToWideChar(CP_ACP, 0, temp, (int)len, NULL, 0);
if (wlen) {
LPWSTR args = (LPWSTR)CoTaskMemAlloc(sizeof(WCHAR) * (wlen + 1));
if (MultiByteToWideChar(CP_ACP, 0, temp, (int)len, args, wlen + 1)) {
*pArguments = args;
} else {
Reported by FlawFinder.
Line: 286
Column: 33
CWE codes:
120
int wlen = MultiByteToWideChar(CP_ACP, 0, temp, (int)len, NULL, 0);
if (wlen) {
LPWSTR args = (LPWSTR)CoTaskMemAlloc(sizeof(WCHAR) * (wlen + 1));
if (MultiByteToWideChar(CP_ACP, 0, temp, (int)len, args, wlen + 1)) {
*pArguments = args;
} else {
OutputDebugString(L"PyShellExt::GetArguments - failed to convert multi-byte to wide-char path");
CoTaskMemFree(args);
hr = E_FAIL;
Reported by FlawFinder.
Modules/_sha3/sha3module.c
4 issues
Line: 128
Column: 35
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
#define SHA3_process Keccak_HashUpdate
#define SHA3_done Keccak_HashFinal
#define SHA3_squeeze Keccak_HashSqueeze
#define SHA3_copystate(dest, src) memcpy(&(dest), &(src), sizeof(SHA3_state))
typedef struct {
PyTypeObject *sha3_224_type;
PyTypeObject *sha3_256_type;
PyTypeObject *sha3_384_type;
Reported by FlawFinder.
Line: 328
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
_sha3_sha3_224_digest_impl(SHA3object *self)
/*[clinic end generated code: output=fd531842e20b2d5b input=5b2a659536bbd248]*/
{
unsigned char digest[SHA3_MAX_DIGESTSIZE + SHA3_LANESIZE];
SHA3_state temp;
HashReturn res;
ENTER_HASHLIB(self);
SHA3_copystate(temp, self->hash_state);
Reported by FlawFinder.
Line: 355
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
_sha3_sha3_224_hexdigest_impl(SHA3object *self)
/*[clinic end generated code: output=75ad03257906918d input=2d91bb6e0d114ee3]*/
{
unsigned char digest[SHA3_MAX_DIGESTSIZE + SHA3_LANESIZE];
SHA3_state temp;
HashReturn res;
/* Get the raw (binary) digest value */
ENTER_HASHLIB(self);
Reported by FlawFinder.
Line: 501
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
static PyObject *
SHA3_get_suffix(SHA3object *self, void *closure)
{
unsigned char suffix[2];
suffix[0] = self->hash_state.delimitedSuffix;
suffix[1] = 0;
return PyBytes_FromStringAndSize((const char *)suffix, 1);
}
Reported by FlawFinder.