Modernize FormatBacktrace() and make portable for Python 3.

llvm-svn: 253085
This commit is contained in:
Zachary Turner
2015-11-13 21:28:45 +00:00
parent 75b4be9a11
commit 2419f1d57c
3 changed files with 26 additions and 21 deletions

View File

@@ -825,6 +825,14 @@ PythonModule::AddModule(llvm::StringRef module)
return PythonModule(PyRefType::Borrowed, PyImport_AddModule(str.c_str()));
}
PythonModule
PythonModule::ImportModule(llvm::StringRef module)
{
std::string str = module.str();
return PythonModule(PyRefType::Owned, PyImport_ImportModule(str.c_str()));
}
bool
PythonModule::Check(PyObject *py_obj)
{