Use .data() instead of .c_str()
This commit is contained in:
parent
91d2740fbf
commit
f172e82f10
1 changed files with 2 additions and 3 deletions
|
|
@ -207,14 +207,13 @@ int py_bool_to(PyObject *boolobj, bool & val){
|
||||||
|
|
||||||
static
|
static
|
||||||
PyObject* py_str_from(const std::string &str){
|
PyObject* py_str_from(const std::string &str){
|
||||||
puts(str.c_str());
|
return PyString_FromStringAndSize(str.data(), str.size());
|
||||||
return PyString_FromStringAndSize(str.c_str(), str.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
PyObject* py_bytes_from(const std::string &str){
|
PyObject* py_bytes_from(const std::string &str){
|
||||||
return PyBytes_FromStringAndSize(str.c_str(), str.size());
|
return PyBytes_FromStringAndSize(str.data(), str.size());
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//static
|
//static
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue