diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2012-08-20 21:16:02 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2012-08-20 21:16:02 +0000 |
| commit | 9b832fe40d24be8e58fe8cfc7199038085534870 (patch) | |
| tree | c79b768dd1e17e7ea7c8b74c05b9f6d1f44f7c0f /lldb/scripts | |
| parent | 784973b89e382c2563b6c543f4e356033c66fbad (diff) | |
| download | bcm5719-llvm-9b832fe40d24be8e58fe8cfc7199038085534870.tar.gz bcm5719-llvm-9b832fe40d24be8e58fe8cfc7199038085534870.zip | |
Fix a crash (_wrap_SBDebugger_SetInputFileHandle -> PyString_AsString) running the test suite.
Also modify the boundary condition test case SBDebugger.DispatchInput(None) to be wrapped inside a try-except clause for now.
llvm-svn: 162228
Diffstat (limited to 'lldb/scripts')
| -rw-r--r-- | lldb/scripts/Python/python-typemaps.swig | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lldb/scripts/Python/python-typemaps.swig b/lldb/scripts/Python/python-typemaps.swig index 31364cac84e..c269795bf5a 100644 --- a/lldb/scripts/Python/python-typemaps.swig +++ b/lldb/scripts/Python/python-typemaps.swig @@ -351,9 +351,15 @@ } %typemap(in) FILE * { - if (!PyFile_Check($input)) { + if ($input == Py_None) + $1 = NULL; + else if (!PyFile_Check($input)) { int fd = PyObject_AsFileDescriptor($input); PyObject *py_mode = PyObject_GetAttrString($input, "mode"); + if (!py_mode) { + PyErr_SetString(PyExc_TypeError,"not a file-like object"); + return NULL; + } const char *mode = PyString_AsString(py_mode); if (-1 != fd && mode) { FILE *f; @@ -366,7 +372,8 @@ return NULL; } } - $1 = PyFile_AsFile($input); + else + $1 = PyFile_AsFile($input); } %typemap(out) FILE * { |

