File: | numpy/core/src/_simd/_simd.c |
Warning: | line 67, column 5 Calling function 'PyDict_SetItemString' with a PyObject argument whose ownership has been released (with stolen reference) |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | #include "_simd.h" | |||
2 | ||||
3 | PyMODINIT_FUNCPyObject* PyInit__simd(void) | |||
4 | { | |||
5 | static struct PyModuleDef defs = { | |||
6 | .m_base = PyModuleDef_HEAD_INIT{ { 1, ((void*)0) }, ((void*)0), 0, ((void*)0), }, | |||
7 | .m_name = "numpy.core._simd", | |||
8 | .m_size = -1 | |||
9 | }; | |||
10 | if (npy_cpu_init() < 0) { | |||
| ||||
11 | return NULL((void*)0); | |||
12 | } | |||
13 | PyObject *m = PyModule_Create(&defs)PyModule_Create2(&defs, 1013); | |||
14 | if (m == NULL((void*)0)) { | |||
15 | return NULL((void*)0); | |||
16 | } | |||
17 | PyObject *targets = PyDict_New(); | |||
18 | if (targets == NULL((void*)0)) { | |||
19 | goto err; | |||
20 | } | |||
21 | if (PyModule_AddObject(m, "targets", targets) < 0) { | |||
22 | Py_DECREF(targets)_Py_DECREF(((PyObject*)(targets))); | |||
23 | goto err; | |||
24 | } | |||
25 | // add keys for non-supported optimizations with None value | |||
26 | #define ATTACH_MODULE(TESTED_FEATURES, TARGET_NAME, MAKE_MSVC_HAPPY){ PyObject *simd_mod; if (!TESTED_FEATURES) { _Py_INCREF(((PyObject *)((&_Py_NoneStruct)))); simd_mod = (&_Py_NoneStruct) ; } else { simd_mod = simd_create_module_TARGET_NAME(); if (simd_mod == ((void*)0)) { goto err; } } const char *target_name = "TARGET_NAME" ; if (PyDict_SetItemString(targets, target_name, simd_mod) < 0) { _Py_DECREF(((PyObject*)(simd_mod))); goto err; } _Py_INCREF (((PyObject*)(simd_mod))); if (PyModule_AddObject(m, target_name , simd_mod) < 0) { _Py_DECREF(((PyObject*)(simd_mod))); goto err; } } \ | |||
27 | { \ | |||
28 | PyObject *simd_mod; \ | |||
29 | if (!TESTED_FEATURES) { \ | |||
30 | Py_INCREF(Py_None)_Py_INCREF(((PyObject*)((&_Py_NoneStruct)))); \ | |||
31 | simd_mod = Py_None(&_Py_NoneStruct); \ | |||
32 | } else { \ | |||
33 | simd_mod = NPY_CAT(simd_create_module_, TARGET_NAME)simd_create_module_TARGET_NAME(); \ | |||
34 | if (simd_mod == NULL((void*)0)) { \ | |||
35 | goto err; \ | |||
36 | } \ | |||
37 | } \ | |||
38 | const char *target_name = NPY_TOSTRING(TARGET_NAME)"TARGET_NAME"; \ | |||
39 | if (PyDict_SetItemString(targets, target_name, simd_mod) < 0) { \ | |||
40 | Py_DECREF(simd_mod)_Py_DECREF(((PyObject*)(simd_mod))); \ | |||
41 | goto err; \ | |||
42 | } \ | |||
43 | Py_INCREF(simd_mod)_Py_INCREF(((PyObject*)(simd_mod))); \ | |||
44 | if (PyModule_AddObject(m, target_name, simd_mod) < 0) { \ | |||
45 | Py_DECREF(simd_mod)_Py_DECREF(((PyObject*)(simd_mod))); \ | |||
46 | goto err; \ | |||
47 | } \ | |||
48 | } | |||
49 | ||||
50 | #define ATTACH_BASELINE_MODULE(MAKE_MSVC_HAPPY){ PyObject *simd_mod = simd_create_module(); if (simd_mod == ( (void*)0)) { goto err; } if (PyDict_SetItemString(targets, "baseline" , simd_mod) < 0) { _Py_DECREF(((PyObject*)(simd_mod))); goto err; } _Py_INCREF(((PyObject*)(simd_mod))); if (PyModule_AddObject (m, "baseline", simd_mod) < 0) { _Py_DECREF(((PyObject*)(simd_mod ))); goto err; } } \ | |||
51 | { \ | |||
52 | PyObject *simd_mod = simd_create_module(); \ | |||
53 | if (simd_mod == NULL((void*)0)) { \ | |||
54 | goto err; \ | |||
55 | } \ | |||
56 | if (PyDict_SetItemString(targets, "baseline", simd_mod) < 0) { \ | |||
57 | Py_DECREF(simd_mod)_Py_DECREF(((PyObject*)(simd_mod))); \ | |||
58 | goto err; \ | |||
59 | } \ | |||
60 | Py_INCREF(simd_mod)_Py_INCREF(((PyObject*)(simd_mod))); \ | |||
61 | if (PyModule_AddObject(m, "baseline", simd_mod) < 0) { \ | |||
62 | Py_DECREF(simd_mod)_Py_DECREF(((PyObject*)(simd_mod))); \ | |||
63 | goto err; \ | |||
64 | } \ | |||
65 | } | |||
66 | ||||
67 | NPY__CPU_DISPATCH_CALL(NPY_CPU_HAVE, ATTACH_MODULE, MAKE_MSVC_HAPPY){ PyObject *simd_mod; if (!(npy_cpu_have(NPY_CPU_FEATURE_AVX512_SKX ))) { _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))); simd_mod = (&_Py_NoneStruct); } else { simd_mod = simd_create_module_AVX512_SKX (); if (simd_mod == ((void*)0)) { goto err; } } const char *target_name = "AVX512_SKX"; if (PyDict_SetItemString(targets, target_name , simd_mod) < 0) { _Py_DECREF(((PyObject*)(simd_mod))); goto err; } _Py_INCREF(((PyObject*)(simd_mod))); if (PyModule_AddObject (m, target_name, simd_mod) < 0) { _Py_DECREF(((PyObject*)( simd_mod))); goto err; } } { PyObject *simd_mod; if (!(npy_cpu_have (NPY_CPU_FEATURE_AVX512F))) { _Py_INCREF(((PyObject*)((&_Py_NoneStruct )))); simd_mod = (&_Py_NoneStruct); } else { simd_mod = simd_create_module_AVX512F (); if (simd_mod == ((void*)0)) { goto err; } } const char *target_name = "AVX512F"; if (PyDict_SetItemString(targets, target_name, simd_mod ) < 0) { _Py_DECREF(((PyObject*)(simd_mod))); goto err; } _Py_INCREF (((PyObject*)(simd_mod))); if (PyModule_AddObject(m, target_name , simd_mod) < 0) { _Py_DECREF(((PyObject*)(simd_mod))); goto err; } } { PyObject *simd_mod; if (!(npy_cpu_have(NPY_CPU_FEATURE_AVX )&&npy_cpu_have(NPY_CPU_FEATURE_F16C)&&npy_cpu_have (NPY_CPU_FEATURE_FMA3)&&npy_cpu_have(NPY_CPU_FEATURE_AVX2 ))) { _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))); simd_mod = (&_Py_NoneStruct); } else { simd_mod = simd_create_module_FMA3__AVX2 (); if (simd_mod == ((void*)0)) { goto err; } } const char *target_name = "FMA3__AVX2"; if (PyDict_SetItemString(targets, target_name , simd_mod) < 0) { _Py_DECREF(((PyObject*)(simd_mod))); goto err; } _Py_INCREF(((PyObject*)(simd_mod))); if (PyModule_AddObject (m, target_name, simd_mod) < 0) { _Py_DECREF(((PyObject*)( simd_mod))); goto err; } } { PyObject *simd_mod; if (!(npy_cpu_have (NPY_CPU_FEATURE_SSE)&&npy_cpu_have(NPY_CPU_FEATURE_SSE2 )&&npy_cpu_have(NPY_CPU_FEATURE_SSE3)&&npy_cpu_have (NPY_CPU_FEATURE_SSSE3)&&npy_cpu_have(NPY_CPU_FEATURE_SSE41 )&&npy_cpu_have(NPY_CPU_FEATURE_POPCNT)&&npy_cpu_have (NPY_CPU_FEATURE_SSE42))) { _Py_INCREF(((PyObject*)((&_Py_NoneStruct )))); simd_mod = (&_Py_NoneStruct); } else { simd_mod = simd_create_module_SSE42 (); if (simd_mod == ((void*)0)) { goto err; } } const char *target_name = "SSE42"; if (PyDict_SetItemString(targets, target_name, simd_mod ) < 0) { _Py_DECREF(((PyObject*)(simd_mod))); goto err; } _Py_INCREF (((PyObject*)(simd_mod))); if (PyModule_AddObject(m, target_name , simd_mod) < 0) { _Py_DECREF(((PyObject*)(simd_mod))); goto err; } } | |||
| ||||
68 | NPY__CPU_DISPATCH_BASELINE_CALL(ATTACH_BASELINE_MODULE, MAKE_MSVC_HAPPY){ PyObject *simd_mod = simd_create_module(); if (simd_mod == ( (void*)0)) { goto err; } if (PyDict_SetItemString(targets, "baseline" , simd_mod) < 0) { _Py_DECREF(((PyObject*)(simd_mod))); goto err; } _Py_INCREF(((PyObject*)(simd_mod))); if (PyModule_AddObject (m, "baseline", simd_mod) < 0) { _Py_DECREF(((PyObject*)(simd_mod ))); goto err; } } | |||
69 | return m; | |||
70 | err: | |||
71 | Py_DECREF(m)_Py_DECREF(((PyObject*)(m))); | |||
72 | return NULL((void*)0); | |||
73 | } |
1 | #ifndef PyDict_New |
2 | struct _object; |
3 | typedef struct _object PyObject; |
4 | PyObject* clang_analyzer_PyObject_New_Reference(); |
5 | PyObject* PyDict_New() { |
6 | return clang_analyzer_PyObject_New_Reference(); |
7 | } |
8 | #else |
9 | #warning "API PyDict_New is defined as a macro." |
10 | #endif |
1 | #ifndef PyModule_AddObject |
2 | struct _object; |
3 | typedef struct _object PyObject; |
4 | void clang_analyzer_PyObject_Steal_Reference(const void *); |
5 | int clang_analyzer_noimpl_conjure_int(); |
6 | int PyModule_AddObject(PyObject *module, const char *name, PyObject *value) { |
7 | int ret = clang_analyzer_noimpl_conjure_int(); |
8 | if (ret >= 0) |
9 | clang_analyzer_PyObject_Steal_Reference(value); |
10 | return ret; |
11 | } |
12 | #else |
13 | #warning "API PyModule_AddObject is defined as a macro." |
14 | #endif |