The following issues were found
numpy/typing/tests/data/fail/arrayprint.py
1 issues
Line: 1
Column: 1
from typing import Callable, Any
import numpy as np
AR: np.ndarray
func1: Callable[[Any], str]
func2: Callable[[np.integer[Any]], str]
np.array2string(AR, style=None) # E: Unexpected keyword argument
np.array2string(AR, legacy="1.14") # E: incompatible type
Reported by Pylint.
numpy/_globals.py
1 issues
Line: 27
Column: 1
# classes defined here.
if '_is_loaded' in globals():
raise RuntimeError('Reloading numpy._globals is not allowed')
_is_loaded = True
class ModuleDeprecationWarning(DeprecationWarning):
"""Module deprecation warning.
Reported by Pylint.
numpy/distutils/pathccompiler.py
1 issues
Line: 1
Column: 1
from distutils.unixccompiler import UnixCCompiler
class PathScaleCCompiler(UnixCCompiler):
"""
PathScale compiler compatible with an gcc built Python.
"""
compiler_type = 'pathcc'
Reported by Pylint.
numpy/core/src/umath/_umath_tests.dispatch.c
1 issues
Line: 16
#include "_umath_tests.dispatch.h"
#endif
NPY_CPU_DISPATCH_DECLARE(const char *_umath_tests_dispatch_func, (void))
NPY_CPU_DISPATCH_DECLARE(extern const char *_umath_tests_dispatch_var)
NPY_CPU_DISPATCH_DECLARE(void _umath_tests_dispatch_attach, (PyObject *list))
const char *NPY_CPU_DISPATCH_CURFX(_umath_tests_dispatch_var) = NPY_TOSTRING(NPY_CPU_DISPATCH_CURFX(var));
const char *NPY_CPU_DISPATCH_CURFX(_umath_tests_dispatch_func)(void)
Reported by Cppcheck.
numpy/core/src/_simd/_simd.h
1 issues
Line: 29
* access to NPYV constants NPY_SIMD, NPY_SIMD_F64, and NPY_SIMD_WIDTH but without
* any intrinsics.
*/
NPY_CPU_DISPATCH_DECLARE(NPY_VISIBILITY_HIDDEN PyObject *simd_create_module, (void))
#endif // _SIMD_SIMD_H_
Reported by Cppcheck.
doc/source/f2py/setup_example.py
1 issues
Line: 1
Column: 1
from numpy.distutils.core import Extension
ext1 = Extension(name = 'scalar',
sources = ['scalar.f'])
ext2 = Extension(name = 'fib2',
sources = ['fib2.pyf', 'fib1.f'])
if __name__ == "__main__":
from numpy.distutils.core import setup
Reported by Pylint.
numpy/core/src/common/npy_hashtable.c
1 issues
Line: 204
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return -1;
}
tb_item[0] = value;
memcpy(tb_item+1, key, tb->key_len * sizeof(PyObject *));
tb->nelem += 1;
}
else {
/* Clear the bucket -- just the value should be enough though. */
memset(tb_item, 0, (tb->key_len + 1) * sizeof(PyObject *));
Reported by FlawFinder.
numpy/core/src/common/python_xerbla.c
1 issues
Line: 26
Column: 9
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 const char format[] = "On entry to %.*s" \
" parameter number %d had an illegal value";
char buf[sizeof(format) + 6 + 4]; /* 6 for name, 4 for param. num. */
int len = 0; /* length of subroutine name*/
#ifdef WITH_THREAD
PyGILState_STATE save;
#endif
Reported by FlawFinder.
numpy/core/src/common/simd/avx512/misc.h
1 issues
Line: 48
Column: 11
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
char i48, char i49, char i50, char i51, char i52, char i53, char i54, char i55,
char i56, char i57, char i58, char i59, char i60, char i61, char i62, char i63)
{
const char NPY_DECL_ALIGNED(64) data[64] = {
i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15,
i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31,
i32, i33, i34, i35, i36, i37, i38, i39, i40, i41, i42, i43, i44, i45, i46, i47,
i48, i49, i50, i51, i52, i53, i54, i55, i56, i57, i58, i59, i60, i61, i62, i63
};
Reported by FlawFinder.
numpy/core/src/common/ucsnarrow.c
1 issues
Line: 59
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
PyErr_NoMemory();
return NULL;
}
memcpy(buf, src, size);
if (swap) {
byte_swap_vector(buf, ucs4len, sizeof(npy_ucs4));
}
src = buf;
}
Reported by FlawFinder.