Author: zturner Date: Mon Nov 16 16:40:12 2015 New Revision: 253261 URL: http://llvm.org/viewvc/llvm-project?rev=253261&view=rev Log: Python3 - Fix some issues related to `PythonFile` class.
Python 3 has lots of new debug asserts, and some of these were firing on PythonFile. Specifically related to handling of invalid files. Modified: lldb/trunk/scripts/Python/python-typemaps.swig lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp Modified: lldb/trunk/scripts/Python/python-typemaps.swig URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=253261&r1=253260&r2=253261&view=diff ============================================================================== --- lldb/trunk/scripts/Python/python-typemaps.swig (original) +++ lldb/trunk/scripts/Python/python-typemaps.swig Mon Nov 16 16:40:12 2015 @@ -552,6 +552,11 @@ File file($1, false); PythonFile py_file(file, mode); $result = py_file.release(); + if (!$result) + { + $result = Py_None; + Py_INCREF(Py_None); + } } %typemap(in) (const char* string, int len) { Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp?rev=253261&r1=253260&r2=253261&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp (original) +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp Mon Nov 16 16:40:12 2015 @@ -1035,6 +1035,12 @@ PythonFile::Reset(PyRefType type, PyObje void PythonFile::Reset(File &file, const char *mode) { + if (!file.IsValid()) + { + Reset(); + return; + } + char *cmode = const_cast<char *>(mode); #if PY_MAJOR_VERSION >= 3 Reset(PyRefType::Owned, _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits