From 32ac147b00e4ffd9f5baddcfabc0fd84a12e9f86 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Mon, 16 Nov 2015 22:40:12 +0000 Subject: 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. llvm-svn: 253261 --- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index e3f84f53df0..3107677ee94 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -1035,6 +1035,12 @@ PythonFile::Reset(PyRefType type, PyObject *py_obj) void PythonFile::Reset(File &file, const char *mode) { + if (!file.IsValid()) + { + Reset(); + return; + } + char *cmode = const_cast(mode); #if PY_MAJOR_VERSION >= 3 Reset(PyRefType::Owned, -- cgit v1.2.3