diff options
author | Zachary Turner <zturner@google.com> | 2015-10-14 21:06:13 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-10-14 21:06:13 +0000 |
commit | 18426935ac8596a42f5cf1a39c7d29e97af8fe21 (patch) | |
tree | 3e89906b3a3b1eee87d9ec15fb87db2f73c8674b /lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h | |
parent | edffd91bcec7cb02dd527a9ca210888b28eaf0f2 (diff) | |
download | bcm5719-llvm-18426935ac8596a42f5cf1a39c7d29e97af8fe21.tar.gz bcm5719-llvm-18426935ac8596a42f5cf1a39c7d29e97af8fe21.zip |
Get Python unit tests working with Python 3.
There were a couple of issues related to string handling that
needed to be fixed. In particular, we cannot get away with
converting `PyUnicode` objects to `PyBytes` objects and storing
the `PyBytes` regardless of Python version. Instead we have to
store a `PyUnicode` on Python 3 and a `PyString` on Python 2.
The reason for this is that if you call `PyObject_Str` on a
`PyBytes` in Python 3, it will return you a string that actually
contains the string value wrappedin the characters b''. So if we
create a `PythonString` with the value "test", and we call Str()
on it, we will get back the string "b'test'", which breaks string
equality. The only way to fix this is to store a native
`PyUnicode` object under Python 3.
With this CL, ScriptInterpreterPythonTests unit tests pass 100%
under Python 2 and Python 3.
llvm-svn: 250327
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h')
0 files changed, 0 insertions, 0 deletions