1#ifndef LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H 2#define LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H 3 4#include <Python.h> 5 6// Defined here instead of a .swig file because SWIG 2 doesn't support 7// explicit deleted functions. 8struct Py_buffer_RAII { 9 Py_buffer buffer = {}; 10 Py_buffer_RAII(){}; 11 Py_buffer &operator=(const Py_buffer_RAII &) = delete; 12 Py_buffer_RAII(const Py_buffer_RAII &) = delete; 13 ~Py_buffer_RAII() { 14 if (buffer.obj) 15 PyBuffer_Release(&buffer); 16 } 17}; 18 19#endif // LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H 20