The following issues were found
Lib/idlelib/idle_test/tkinter_testing_utils.py
2 issues
Line: 58
Column: 17
root.mainloop()
if exception:
raise exception
return new_test_method
return decorator
Reported by Pylint.
Line: 45
Column: 24
next(test_generator)
except StopIteration:
root.quit()
except Exception as exc:
exception = exc
root.quit()
else:
# Schedule the Tk mainloop to call this function again,
# using a robust method of ensuring that it gets a
Reported by Pylint.
Include/sysmodule.h
2 issues
Line: 18
Column: 43
CWE codes:
134
Suggestion:
Use a constant for the format specification
PyAPI_FUNC(void) PySys_SetPath(const wchar_t *);
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...);
PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...);
Reported by FlawFinder.
Line: 20
Column: 43
CWE codes:
134
Suggestion:
Use a constant for the format specification
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...);
PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...);
PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *);
Reported by FlawFinder.
Lib/this.py
2 issues
Line: 1
Column: 1
s = """Gur Mra bs Clguba, ol Gvz Crgref
Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Reported by Pylint.
Line: 1
Column: 1
s = """Gur Mra bs Clguba, ol Gvz Crgref
Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Reported by Pylint.
Objects/setobject.c
2 issues
Line: 1079
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (a->table == a->smalltable || b->table == b->smalltable) {
memcpy(tab, a->smalltable, sizeof(tab));
memcpy(a->smalltable, b->smalltable, sizeof(tab));
memcpy(b->smalltable, tab, sizeof(tab));
}
if (PyType_IsSubtype(Py_TYPE(a), &PyFrozenSet_Type) &&
PyType_IsSubtype(Py_TYPE(b), &PyFrozenSet_Type)) {
Reported by FlawFinder.
Line: 1080
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (a->table == a->smalltable || b->table == b->smalltable) {
memcpy(tab, a->smalltable, sizeof(tab));
memcpy(a->smalltable, b->smalltable, sizeof(tab));
memcpy(b->smalltable, tab, sizeof(tab));
}
if (PyType_IsSubtype(Py_TYPE(a), &PyFrozenSet_Type) &&
PyType_IsSubtype(Py_TYPE(b), &PyFrozenSet_Type)) {
h = a->hash; a->hash = b->hash; b->hash = h;
Reported by FlawFinder.
Objects/structseq.c
2 issues
Line: 244
Column: 48
CWE codes:
126
/* Write "typename(" */
PyObject *type_name = PyUnicode_DecodeUTF8(typ->tp_name,
strlen(typ->tp_name),
NULL);
if (type_name == NULL) {
return NULL;
}
Reported by FlawFinder.
Line: 282
Column: 58
CWE codes:
126
goto error;
}
PyObject *name = PyUnicode_DecodeUTF8(name_utf8, strlen(name_utf8), NULL);
if (name == NULL) {
goto error;
}
if (_PyUnicodeWriter_WriteStr(&writer, name) < 0) {
Py_DECREF(name);
Reported by FlawFinder.
PC/clinic/msvcrtmodule.c.h
2 issues
Line: 243
Column: 5
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
msvcrt_getch(PyObject *module, PyObject *Py_UNUSED(ignored))
{
PyObject *return_value = NULL;
char s[1];
s[0] = msvcrt_getch_impl(module);
return_value = PyBytes_FromStringAndSize(s, 1);
return return_value;
Reported by FlawFinder.
Line: 291
Column: 5
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
msvcrt_getche(PyObject *module, PyObject *Py_UNUSED(ignored))
{
PyObject *return_value = NULL;
char s[1];
s[0] = msvcrt_getche_impl(module);
return_value = PyBytes_FromStringAndSize(s, 1);
return return_value;
Reported by FlawFinder.
Lib/tkinter/test/runtktests.py
2 issues
Line: 65
Column: 17
attrs.append('tests_gui')
for module in get_tests_modules(gui=gui, packages=packages):
for attr in attrs:
for test in getattr(module, attr, ()):
yield test
if __name__ == "__main__":
test.support.run_unittest(*get_tests())
Reported by Pylint.
Line: 15
Column: 1
this_dir_path = os.path.abspath(os.path.dirname(__file__))
def is_package(path):
for name in os.listdir(path):
if name in ('__init__.py', '__init__.pyc'):
return True
return False
Reported by Pylint.
PC/layout/__main__.py
2 issues
Line: 4
Column: 5
import sys
try:
import layout
except ImportError:
# Failed to import our package, which likely means we were started directly
# Add the additional search path needed to locate our module.
from pathlib import Path
Reported by Pylint.
Line: 1
Column: 1
import sys
try:
import layout
except ImportError:
# Failed to import our package, which likely means we were started directly
# Add the additional search path needed to locate our module.
from pathlib import Path
Reported by Pylint.
PC/layout/support/constants.py
2 issues
Line: 9
Column: 1
__version__ = "3.8"
import os
import re
import struct
import sys
def _unpack_hexversion():
Reported by Pylint.
Line: 16
Column: 9
def _unpack_hexversion():
try:
hexversion = int(os.getenv("PYTHON_HEXVERSION"), 16)
except (TypeError, ValueError):
hexversion = sys.hexversion
return struct.pack(">i", sys.hexversion)
Reported by Pylint.
Modules/clinic/posixmodule.c.h
2 issues
Line: 3226
Column: 9
CWE codes:
126
if (user == NULL) {
goto exit;
}
if (strlen(user) != (size_t)user_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
basegid = _PyLong_AsInt(args[1]);
if (basegid == -1 && PyErr_Occurred()) {
Reported by FlawFinder.
Line: 3280
Column: 9
CWE codes:
126
if (user == NULL) {
goto exit;
}
if (strlen(user) != (size_t)user_length) {
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
if (!_Py_Gid_Converter(args[1], &basegid)) {
goto exit;
Reported by FlawFinder.