xref: /openbsd-src/gnu/llvm/lldb/bindings/python/python-typemaps.h (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
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.
8 struct Py_buffer_RAII {
9   Py_buffer buffer = {};
Py_buffer_RAIIPy_buffer_RAII10   Py_buffer_RAII(){};
11   Py_buffer &operator=(const Py_buffer_RAII &) = delete;
12   Py_buffer_RAII(const Py_buffer_RAII &) = delete;
~Py_buffer_RAIIPy_buffer_RAII13   ~Py_buffer_RAII() {
14     if (buffer.obj)
15       PyBuffer_Release(&buffer);
16   }
17 };
18 
19 #endif // LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
20