Skip to content

Commit 810b5d8

Browse files
jcarpentnim65spre-commit-ci[bot]
authored
FIx issue related to Python 3.10 (#304)
* cmake: use REQUIRED * core: fix issue with Python 3.10 and more * core: fix logic * core: fix * core: further fix * Core: use official solution Co-authored-by: Guilhem Saurel <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * core: fix Co-authored-by: Guilhem Saurel <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6a586fc commit 810b5d8

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ else()
8080
set(PYTHON_COMPONENTS Interpreter Development.Module NumPy)
8181
endif()
8282
set(PYTHON_EXPORT_DEPENDENCY ON)
83-
findpython()
83+
findpython(REQUIRED)
8484

8585
if(WIN32)
8686
link_directories(${PYTHON_LIBRARY_DIRS})

include/eigenpy/memory.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
/*
22
* Copyright 2014-2019, CNRS
3-
* Copyright 2018-2019, INRIA
3+
* Copyright 2018-2022, INRIA
44
*/
55

66
#ifndef __eigenpy_memory_hpp__
77
#define __eigenpy_memory_hpp__
88

99
#include "eigenpy/fwd.hpp"
1010

11+
#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_SIZE)
12+
static inline void _Py_SET_SIZE(PyVarObject* ob, Py_ssize_t size) {
13+
ob->ob_size = size;
14+
}
15+
#define Py_SET_SIZE(ob, size) _Py_SET_SIZE((PyVarObject*)(ob), size)
16+
#endif
17+
1118
/**
1219
* This section contains a convenience MACRO which allows an easy specialization
1320
* of Boost Python Object allocator for struct data types containing Eigen
@@ -66,7 +73,7 @@
6673
reinterpret_cast<Py_ssize_t>(holder) - \
6774
reinterpret_cast<Py_ssize_t>(&instance->storage) + \
6875
static_cast<Py_ssize_t>(offsetof(instance_t, storage)); \
69-
Py_SIZE(instance) = holder_offset; \
76+
Py_SET_SIZE(instance, holder_offset); \
7077
\
7178
protect.cancel(); \
7279
} \

0 commit comments

Comments
 (0)