| File: | _devicearray.cpp | 
| Warning: | line 136, column 5 Calling function '_Py_XDECREF' with a PyObject argument whose ownership has been released  | 
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* This file contains the base class implementation for all device arrays. The | |||
| 2 | * base class is implemented in C so that computing typecodes for device arrays | |||
| 3 | * can be implemented efficiently. */ | |||
| 4 | ||||
| 5 | #include "_pymodule.h" | |||
| 6 | ||||
| 7 | ||||
| 8 | /* Include _devicearray., but make sure we don't get the definitions intended | |||
| 9 | * for consumers of the Device Array API. | |||
| 10 | */ | |||
| 11 | #define NUMBA_IN_DEVICEARRAY_CPP_ | |||
| 12 | #include "_devicearray.h" | |||
| 13 | ||||
| 14 | /* DeviceArray PyObject implementation. Note that adding more members here is | |||
| 15 | * presently prohibited because mapped and managed arrays derive from both | |||
| 16 | * DeviceArray and NumPy's ndarray, which is also a C extension class - the | |||
| 17 | * layout of the object cannot be resolved if this class also has members beyond | |||
| 18 | * PyObject_HEAD. */ | |||
| 19 | class DeviceArray { | |||
| 20 | PyObject_HEADPyObject ob_base; | |||
| 21 | }; | |||
| 22 | ||||
| 23 | /* Trivial traversal - DeviceArray instances own nothing. */ | |||
| 24 | static int | |||
| 25 | DeviceArray_traverse(DeviceArray *self, visitproc visit, void *arg) | |||
| 26 | { | |||
| 27 | return 0; | |||
| 28 | } | |||
| 29 | ||||
| 30 | /* Trivial clear of all references - DeviceArray instances own nothing. */ | |||
| 31 | static int | |||
| 32 | DeviceArray_clear(DeviceArray *self) | |||
| 33 | { | |||
| 34 | return 0; | |||
| 35 | } | |||
| 36 | ||||
| 37 | /* The _devicearray.DeviceArray type */ | |||
| 38 | PyTypeObject DeviceArrayType = { | |||
| 39 | PyVarObject_HEAD_INIT(NULL, 0){ { 1, __null }, 0 }, | |||
| 40 | "_devicearray.DeviceArray", /* tp_name */ | |||
| 41 | sizeof(DeviceArray), /* tp_basicsize */ | |||
| 42 | 0, /* tp_itemsize */ | |||
| 43 | 0, /* tp_dealloc */ | |||
| 44 | 0, /* tp_print */ | |||
| 45 | 0, /* tp_getattr */ | |||
| 46 | 0, /* tp_setattr */ | |||
| 47 | 0, /* tp_compare */ | |||
| 48 | 0, /* tp_repr */ | |||
| 49 | 0, /* tp_as_number */ | |||
| 50 | 0, /* tp_as_sequence */ | |||
| 51 | 0, /* tp_as_mapping */ | |||
| 52 | 0, /* tp_hash */ | |||
| 53 | 0, /* tp_call*/ | |||
| 54 | 0, /* tp_str*/ | |||
| 55 | 0, /* tp_getattro*/ | |||
| 56 | 0, /* tp_setattro*/ | |||
| 57 | 0, /* tp_as_buffer*/ | |||
| 58 | Py_TPFLAGS_DEFAULT( 0 | (1UL << 18) | 0) | Py_TPFLAGS_BASETYPE(1UL << 10) | Py_TPFLAGS_HAVE_GC(1UL << 14), | |||
| 59 | /* tp_flags*/ | |||
| 60 | "DeviceArray object", /* tp_doc */ | |||
| 61 | (traverseproc) DeviceArray_traverse, /* tp_traverse */ | |||
| 62 | (inquiry) DeviceArray_clear, /* tp_clear */ | |||
| 63 | 0, /* tp_richcompare */ | |||
| 64 | 0, /* tp_weaklistoffset */ | |||
| 65 | 0, /* tp_iter */ | |||
| 66 | 0, /* tp_iternext */ | |||
| 67 | 0, /* tp_methods */ | |||
| 68 | 0, /* tp_members */ | |||
| 69 | 0, /* tp_getset */ | |||
| 70 | 0, /* tp_base */ | |||
| 71 | 0, /* tp_dict */ | |||
| 72 | 0, /* tp_descr_get */ | |||
| 73 | 0, /* tp_descr_set */ | |||
| 74 | 0, /* tp_dictoffset */ | |||
| 75 | 0, /* tp_init */ | |||
| 76 | 0, /* tp_alloc */ | |||
| 77 | 0, /* tp_new */ | |||
| 78 | 0, /* tp_free */ | |||
| 79 | 0, /* tp_is_gc */ | |||
| 80 | 0, /* tp_bases */ | |||
| 81 | 0, /* tp_mro */ | |||
| 82 | 0, /* tp_cache */ | |||
| 83 | 0, /* tp_subclasses */ | |||
| 84 | 0, /* tp_weaklist */ | |||
| 85 | 0, /* tp_del */ | |||
| 86 | 0, /* tp_version_tag */ | |||
| 87 | 0, /* tp_finalize */ | |||
| 88 | #if PY_MAJOR_VERSION3 == 3 && PY_MINOR_VERSION8 == 8 | |||
| 89 | 0, /* tp_vectorcall */ | |||
| 90 | 0, /* tp_print */ | |||
| 91 | #endif | |||
| 92 | }; | |||
| 93 | ||||
| 94 | /* CUDA device array C API */ | |||
| 95 | static void *_DeviceArray_API[1] = { | |||
| 96 | (void*)&DeviceArrayType | |||
| 97 | }; | |||
| 98 | ||||
| 99 | MOD_INIT(_devicearray)extern "C" PyObject* PyInit__devicearray(void) { | |||
| 100 | PyObject *m = nullptr; | |||
| 101 | PyObject *d = nullptr; | |||
| 102 | PyObject *c_api = nullptr; | |||
| 103 | int error = 0; | |||
| 104 | ||||
| 105 |     MOD_DEF(m, "_devicearray", "No docs", NULL){ static struct PyModuleDef moduledef = { { { 1, __null }, __null , 0, __null, }, "_devicearray", "No docs", -1, __null, __null , __null, __null, __null }; m = PyModule_Create2(&moduledef , 1013); }  | |||
| 106 | if (m == NULL__null) | |||
  | ||||
| 107 | goto error_occurred; | |||
| 108 | ||||
| 109 | c_api = PyCapsule_New((void *)_DeviceArray_API, "numba._devicearray._DEVICEARRAY_API", NULL__null); | |||
| 110 | if (c_api == NULL__null) | |||
| 111 | goto error_occurred; | |||
| 112 | ||||
| 113 | DeviceArrayType.tp_new = PyType_GenericNew; | |||
| 114 | if (PyType_Ready(&DeviceArrayType) < 0) | |||
| 115 | goto error_occurred; | |||
| 116 | ||||
| 117 | Py_INCREF(&DeviceArrayType)_Py_INCREF(((PyObject*)(&DeviceArrayType))); | |||
| 118 | error = PyModule_AddObject(m, "DeviceArray", (PyObject*)(&DeviceArrayType)); | |||
| 119 | if (error) | |||
| 120 | goto error_occurred; | |||
| 121 | ||||
| 122 | d = PyModule_GetDict(m); | |||
| 123 | if (d == NULL__null) | |||
| 124 | goto error_occurred; | |||
| 125 | ||||
| 126 | error = PyDict_SetItemString(d, "_DEVICEARRAY_API", c_api); | |||
| 127 | Py_DECREF(c_api)_Py_DECREF(((PyObject*)(c_api))); | |||
| 128 | ||||
| 129 | if (error) | |||
| 130 | goto error_occurred; | |||
| 131 | ||||
| 132 | return MOD_SUCCESS_VAL(m)m; | |||
| 133 | ||||
| 134 | error_occurred: | |||
| 135 | Py_XDECREF(m)_Py_XDECREF(((PyObject*)(m))); | |||
| 136 | Py_XDECREF(c_api)_Py_XDECREF(((PyObject*)(c_api))); | |||
  | ||||
| 137 | Py_XDECREF((PyObject*)&DeviceArrayType)_Py_XDECREF(((PyObject*)((PyObject*)&DeviceArrayType))); | |||
| 138 | ||||
| 139 | return MOD_ERROR_VAL__null; | |||
| 140 | } | 
| 1 | #ifndef PyCapsule_New | 
| 2 | struct _object; | 
| 3 | typedef struct _object PyObject; | 
| 4 | PyObject* clang_analyzer_PyObject_New_Reference(); | 
| 5 | PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor) { | 
| 6 | return clang_analyzer_PyObject_New_Reference(); | 
| 7 | } | 
| 8 | #else | 
| 9 | #warning "API PyCapsule_New is defined as a macro." | 
| 10 | #endif | 
| 1 | void _Py_DECREF(PyObject *op) { --op->ob_refcnt; } |