summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-10-14 21:06:13 +0000
committerZachary Turner <zturner@google.com>2015-10-14 21:06:13 +0000
commit18426935ac8596a42f5cf1a39c7d29e97af8fe21 (patch)
tree3e89906b3a3b1eee87d9ec15fb87db2f73c8674b /lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
parentedffd91bcec7cb02dd527a9ca210888b28eaf0f2 (diff)
downloadbcm5719-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/PythonDataObjects.h')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud