summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorDaryl W. Grunau <DarylGrunau@gmail.com>2019-11-07 18:05:16 -0700
committerAdam J. Stewart <ajstewart426@gmail.com>2019-11-07 19:05:16 -0600
commitae6229dee20da04b2120dc97cdfae800c136e42a (patch)
treec648932512d50b05166647f82d1b20fa2b6d308e /var
parent119af6d71b206da9b32874d9583c8fb3b23f9de8 (diff)
downloadspack-ae6229dee20da04b2120dc97cdfae800c136e42a.tar.gz
spack-ae6229dee20da04b2120dc97cdfae800c136e42a.tar.bz2
spack-ae6229dee20da04b2120dc97cdfae800c136e42a.tar.xz
spack-ae6229dee20da04b2120dc97cdfae800c136e42a.zip
llvm: fix PythonString::GetString for >=python-3.7 (#13631)
* llvm: fix PythonString::GetString for >=python-3.7 * llvm/package.py: fix when the patch should be applied
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/llvm/llvm_py37.patch37
-rw-r--r--var/spack/repos/builtin/packages/llvm/package.py5
2 files changed, 42 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/llvm/llvm_py37.patch b/var/spack/repos/builtin/packages/llvm/llvm_py37.patch
new file mode 100644
index 0000000000..9369019d8a
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/llvm_py37.patch
@@ -0,0 +1,37 @@
+From ecdefed7f6ba11421fe1ecc6c13a135ab7bcda73 Mon Sep 17 00:00:00 2001
+From: Pavel Labath <labath@google.com>
+Date: Mon, 23 Jul 2018 11:37:36 +0100
+Subject: [PATCH] Fix PythonString::GetString for >=python-3.7
+
+The return value of PyUnicode_AsUTF8AndSize is now "const char *".
+---
+ .../Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/tools/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/tools/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+index 6a9d57d5a..94f16b2c7 100644
+--- a/tools/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
++++ b/tools/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+@@ -404,14 +404,16 @@ llvm::StringRef PythonString::GetString() const {
+ return llvm::StringRef();
+
+ Py_ssize_t size;
+- char *c;
++ const char *data;
+
+ #if PY_MAJOR_VERSION >= 3
+- c = PyUnicode_AsUTF8AndSize(m_py_obj, &size);
++ data = PyUnicode_AsUTF8AndSize(m_py_obj, &size);
+ #else
++ char *c;
+ PyString_AsStringAndSize(m_py_obj, &c, &size);
++ data = c;
+ #endif
+- return llvm::StringRef(c, size);
++ return llvm::StringRef(data, size);
+ }
+
+ size_t PythonString::GetSize() const {
+--
+2.18.0.233.g985f88cf7e-goog
+
diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py
index eaba6d7b86..8cb863b445 100644
--- a/var/spack/repos/builtin/packages/llvm/package.py
+++ b/var/spack/repos/builtin/packages/llvm/package.py
@@ -604,6 +604,11 @@ class Llvm(CMakePackage):
# for a bug report about this problem in llvm master.
patch('constexpr_longdouble.patch', when='@6:8+libcxx')
+ # Backport from llvm master; see
+ # https://bugs.llvm.org/show_bug.cgi?id=38233
+ # for a bug report about this problem in llvm master.
+ patch('llvm_py37.patch', when='@4:6 ^python@3.7:')
+
@run_before('cmake')
def check_darwin_lldb_codesign_requirement(self):
if not self.spec.satisfies('+lldb platform=darwin'):