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
This commit is contained in:
Zachary Turner
2015-11-16 22:40:12 +00:00
parent 5883a73f18
commit 32ac147b00
2 changed files with 11 additions and 0 deletions

View File

@@ -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<char *>(mode);
#if PY_MAJOR_VERSION >= 3
Reset(PyRefType::Owned,