[LLDB][PythonFile] fix dangerous borrow semantics on python2
authorLawrence D'Anna <lawrence_danna@apple.com>
Wed, 30 Oct 2019 16:45:13 +0000 (09:45 -0700)
committerLawrence D'Anna <lawrence_danna@apple.com>
Wed, 30 Oct 2019 16:46:51 +0000 (09:46 -0700)
commit3071ebf7b38341e89be04aa64c257c4643e0648c
treedd8c3ba1dd23d951146cce6085e576635f8c0cb8
parentfbe7f5e9729ac24374182fca92242f88baa08f90
[LLDB][PythonFile] fix dangerous borrow semantics on python2

Summary:
It is inherently unsafe to allow a python program to manipulate borrowed
memory from a python object's destructor.     It would be nice to
flush a borrowed file when python is finished with it, but it's not safe
to do on python 2.

Python 3 does not suffer from this issue.

Reviewers: labath, mgorny

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D69532
lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp