Merged
fix(runtime): 修复 PyACL Allocator 回调大小参数截断 #5802
KaranocaVeAdd on Oct 22
fix(runtime): 修复 PyACL Allocator 回调大小参数截断 #5802
Merged
Total: 1 files changed+2-2
| @@ -49,7 +49,7 @@ PyObject* WrapAclRtAllocatorSetObjToDesc(PyObject* /* self */, PyObject* args) | |||
| 49 | static void* AllocatorAllocFunc(const aclrtAllocator allocator, const size_t size) | 49 | static void* AllocatorAllocFunc(const aclrtAllocator allocator, const size_t size) |
| 50 | { | 50 | { |
| 51 | PyGILState_STATE state = PyGILState_Ensure(); | 51 | PyGILState_STATE state = PyGILState_Ensure(); |
| 52 | - PyObject* argslist = Py_BuildValue("kI", allocator, size); | 52 | + PyObject* argslist = Py_BuildValue("kK", allocator, static_cast<unsigned long long>(size)); |
| 53 | 53 | ||
| 54 | PyObject* result = PyObject_CallObject(g_allocFunc, argslist); | 54 | PyObject* result = PyObject_CallObject(g_allocFunc, argslist); |
| 55 | 55 | ||
| @@ -123,7 +123,7 @@ PyObject* WrapAclRtAllocatorSetFreeFuncToDesc(PyObject* /* self */, PyObject* ar | |||
| 123 | static void* AllocatorAllocAdviseFunc(const aclrtAllocator allocator, const size_t size, const aclrtAllocatorAddr addr) | 123 | static void* AllocatorAllocAdviseFunc(const aclrtAllocator allocator, const size_t size, const aclrtAllocatorAddr addr) |
| 124 | { | 124 | { |
| 125 | PyGILState_STATE state = PyGILState_Ensure(); | 125 | PyGILState_STATE state = PyGILState_Ensure(); |
| 126 | - PyObject* argslist = Py_BuildValue("kIk", allocator, size, addr); | 126 | + PyObject* argslist = Py_BuildValue("kKk", allocator, static_cast<unsigned long long>(size), addr); |
| 127 | 127 | ||
| 128 | PyObject* result = PyObject_CallObject(g_allocAdviseFunc, argslist); | 128 | PyObject* result = PyObject_CallObject(g_allocAdviseFunc, argslist); |
| 129 | 129 | ||