We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d437b4 commit dfdf8f2Copy full SHA for dfdf8f2
src/knuth-bendix.cpp
@@ -53,7 +53,12 @@ namespace libsemigroups {
53
54
namespace {
55
std::string to_latin1(std::string const& u) {
56
- static py::object bytes = py::globals()["__builtins__"]["bytes"];
+ static py::object bytes;
57
+ try {
58
+ bytes = py::getattr(py::globals()["__builtins__"], "bytes");
59
+ } catch (py::error_already_set& e) {
60
+ bytes = py::globals()["__builtins__"]["bytes"];
61
+ }
62
return PyBytes_AS_STRING(bytes(py::str(u), "latin1").ptr());
63
}
64
0 commit comments