mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 02:38:07 +08:00
[lldb] Remove bindings/python/python-typemaps.h (#167966)
The minimum supported SWIG version is 4.0 so there's no need for using a separate file anymore.
This commit is contained in:
committed by
GitHub
parent
513232fb33
commit
36848a3710
@@ -1,19 +0,0 @@
|
||||
#ifndef LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
|
||||
#define LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
// Defined here instead of a .swig file because SWIG 2 doesn't support
|
||||
// explicit deleted functions.
|
||||
struct Py_buffer_RAII {
|
||||
Py_buffer buffer = {};
|
||||
Py_buffer_RAII(){};
|
||||
Py_buffer &operator=(const Py_buffer_RAII &) = delete;
|
||||
Py_buffer_RAII(const Py_buffer_RAII &) = delete;
|
||||
~Py_buffer_RAII() {
|
||||
if (buffer.obj)
|
||||
PyBuffer_Release(&buffer);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
|
||||
@@ -6,12 +6,6 @@ AND call SWIG_fail at the same time, because it will result in a double free.
|
||||
|
||||
*/
|
||||
|
||||
%inline %{
|
||||
|
||||
#include "../bindings/python/python-typemaps.h"
|
||||
|
||||
%}
|
||||
|
||||
%typemap(in) char ** {
|
||||
/* Check if is a list */
|
||||
if (PythonList::Check($input)) {
|
||||
@@ -640,6 +634,18 @@ template <> bool SetNumberFromPyObject<double>(double &number, PyObject *obj) {
|
||||
//
|
||||
// I've also moved the call to PyBuffer_Release to the end of the SWIG wrapper,
|
||||
// doing it right away is not legal according to the python buffer protocol.
|
||||
%inline %{
|
||||
struct Py_buffer_RAII {
|
||||
Py_buffer buffer = {};
|
||||
Py_buffer_RAII(){};
|
||||
Py_buffer &operator=(const Py_buffer_RAII &) = delete;
|
||||
Py_buffer_RAII(const Py_buffer_RAII &) = delete;
|
||||
~Py_buffer_RAII() {
|
||||
if (buffer.obj)
|
||||
PyBuffer_Release(&buffer);
|
||||
}
|
||||
};
|
||||
%}
|
||||
|
||||
%define %pybuffer_mutable_binary(TYPEMAP, SIZE)
|
||||
%typemap(in) (TYPEMAP, SIZE) (Py_buffer_RAII view) {
|
||||
|
||||
Reference in New Issue
Block a user