Skip to content

Commit

Permalink
Update Pythonize.cxx
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronj0 authored Sep 22, 2024
1 parent d7812b6 commit 944a1f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Pythonize.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ bool CPyCppyy::Pythonize(PyObject* pyclass, Cppyy::TCppScope_t scope)
Utility::AddToClass(pyclass, "__iter__", (PyCFunction)PyObject_SelfIter, METH_NOARGS);
}

else if (name == "std::basic_string<char>" || name == "basic_string<char>") { // TODO: ask backend as well
else if (name == "std::basic_string<char>") { // TODO: ask backend as well
Utility::AddToClass(pyclass, "__repr__", (PyCFunction)STLStringRepr, METH_NOARGS);
Utility::AddToClass(pyclass, "__str__", (PyCFunction)STLStringStr, METH_NOARGS);
Utility::AddToClass(pyclass, "__bytes__", (PyCFunction)STLStringBytes, METH_NOARGS);
Expand All @@ -1868,12 +1868,12 @@ bool CPyCppyy::Pythonize(PyObject* pyclass, Cppyy::TCppScope_t scope)
((PyTypeObject*)pyclass)->tp_hash = (hashfunc)STLStringHash;
}

else if (name == "std::basic_string_view<char>" || name == "basic_string_view<char>") {
else if (name == "std::basic_string_view<char>") {
Utility::AddToClass(pyclass, "__real_init", "__init__");
Utility::AddToClass(pyclass, "__init__", (PyCFunction)StringViewInit, METH_VARARGS | METH_KEYWORDS);
}

else if (name == "std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >" || name == "basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >") {
else if (name == "std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >") {
Utility::AddToClass(pyclass, "__repr__", (PyCFunction)STLWStringRepr, METH_NOARGS);
Utility::AddToClass(pyclass, "__str__", (PyCFunction)STLWStringStr, METH_NOARGS);
Utility::AddToClass(pyclass, "__bytes__", (PyCFunction)STLWStringBytes, METH_NOARGS);
Expand Down

0 comments on commit 944a1f0

Please sign in to comment.