diff --git a/rclpy/src/rclpy/_rclpy_pycapsule.c b/rclpy/src/rclpy/_rclpy_pycapsule.c index 80d504613..a654d2464 100644 --- a/rclpy/src/rclpy/_rclpy_pycapsule.c +++ b/rclpy/src/rclpy/_rclpy_pycapsule.c @@ -68,8 +68,7 @@ rclpy_pycapsule_pointer(PyObject * Py_UNUSED(self), PyObject * args) return NULL; } - _Static_assert(sizeof(uint64_t) >= sizeof(void *), "Unable to cast pointer to integer"); - return PyLong_FromUnsignedLongLong((uint64_t)pointer); + return PyLong_FromVoidPtr(pointer); } /// Destroy a pycapsule without waiting for the garbage collector.