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