mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-02-01 04:25:36 +08:00
Fix Compile Error: str Naming
This fixes a build error compiling with `nvcc/7.5` + `gcc/4.9.2`
causing a
```
./include/pybind11/pybind11.h(952): here
./include/pybind11/pytypes.h: In member function ‘pybind11::str pybind11::handle::str() const’:
./include/pybind11/pytypes.h:269:8: error: expected primary-expression before ‘class’
return pybind11::str(str, false);
^
./include/pybind11/pytypes.h:269:8: error: expected ‘;’ before ‘class’
./include/pybind11/pytypes.h:269:8: error: expected primary-expression before ‘class’
```
This commit is contained in:
parent
61587164ed
commit
7cd569c703
@ -261,12 +261,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline pybind11::str handle::str() const {
|
inline pybind11::str handle::str() const {
|
||||||
PyObject *str = PyObject_Str(m_ptr);
|
PyObject *strValue = PyObject_Str(m_ptr);
|
||||||
#if PY_MAJOR_VERSION < 3
|
#if PY_MAJOR_VERSION < 3
|
||||||
PyObject *unicode = PyUnicode_FromEncodedObject(str, "utf-8", nullptr);
|
PyObject *unicode = PyUnicode_FromEncodedObject(strValue, "utf-8", nullptr);
|
||||||
Py_XDECREF(str); str = unicode;
|
Py_XDECREF(strValue); strValue = unicode;
|
||||||
#endif
|
#endif
|
||||||
return pybind11::str(str, false);
|
return pybind11::str(strValue, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
class bytes : public object {
|
class bytes : public object {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user