diff options
author | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-10-28 21:59:04 -0700 |
---|---|---|
committer | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-10-29 09:41:22 -0700 |
commit | 6a93a12a8dd98291225a282b5b8f3c97e68ebe49 (patch) | |
tree | 8c434bc0d961e94ad245051106c1205f69eeedbe /lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h | |
parent | 5503455ccb3f5fcedced158332c016c8d3a7fa81 (diff) | |
download | bcm5719-llvm-6a93a12a8dd98291225a282b5b8f3c97e68ebe49.tar.gz bcm5719-llvm-6a93a12a8dd98291225a282b5b8f3c97e68ebe49.zip |
[LLDB][Python] fix another fflush issue on NetBSD
Summary:
Here's another instance where we were calling fflush on an input
stream, which is illegal on NetBSD.
Reviewers: labath, mgorny
Reviewed By: mgorny
Subscribers: krytarowski, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D69488
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h index 373d3212697..302901664ec 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -189,6 +189,14 @@ inline llvm::Error keyError() { "key not in dict"); } +#if PY_MAJOR_VERSION < 3 +// The python 2 API declares some arguments as char* that should +// be const char *, but it doesn't actually modify them. +inline char *py2_const_cast(const char *s) { return const_cast<char *>(s); } +#else +inline const char *py2_const_cast(const char *s) { return s; } +#endif + enum class PyInitialValue { Invalid, Empty }; template <typename T, typename Enable = void> struct PythonFormat; @@ -309,16 +317,6 @@ public: StructuredData::ObjectSP CreateStructuredObject() const; -protected: - -#if PY_MAJOR_VERSION < 3 - // The python 2 API declares some arguments as char* that should - // be const char *, but it doesn't actually modify them. - static char *py2_const_cast(const char *s) { return const_cast<char *>(s); } -#else - static const char *py2_const_cast(const char *s) { return s; } -#endif - public: template <typename... T> llvm::Expected<PythonObject> CallMethod(const char *name, |