fix: throw error_already_set in py::len on failing PyObject_Length (#2575)

* Throw error_already_set in py::len on failing PyObject_Length

* Fix tests to mach error message on PyPy
This commit is contained in:
Yannick Jadoul
2020-10-13 05:00:54 +02:00
committed by GitHub
parent 2f746eeeb4
commit 99773fc5f6
3 changed files with 16 additions and 1 deletions

View File

@@ -407,4 +407,7 @@ TEST_SUBMODULE(pytypes, m) {
buf, static_cast<ssize_t>(strlen(buf)));
});
#endif
// test_builtin_functions
m.def("get_len", [](py::handle h) { return py::len(h); });
}