Skip to content

Commit 06a6eee

Browse files
committed
Update conversion of native enum values
1 parent 8f5a5b5 commit 06a6eee

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/icspacket/include/skeletons/py_convert.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#ifndef _PyConvert_H_
77
#define _PyConvert_H_
88

9+
#define PY_SSIZE_T_CLEAN
910
#include <Python.h>
1011
#include <py_application.h>
1112

@@ -213,7 +214,7 @@ static inline PyObject *PyCompatEnum_FromSsize_t(PyObject *pEnumType,
213214
static inline PyObject *PyCompatEnum_FromSize_t(PyObject *pEnumType,
214215
size_t value) {
215216
PyObject *nValue = NULL, *nResult = NULL;
216-
if ((nValue = PyLong_FromSize_t(value)) == NULL) {
217+
if ((nValue = PyLong_FromSize_t(value & 0x7fffffffffffffff)) == NULL) {
217218
goto end;
218219
}
219220
nResult = PyObject_CallOneArg(pEnumType, nValue);

0 commit comments

Comments
 (0)