Fix typing

This commit is contained in:
Romain Thomas
2023-10-22 14:00:04 +02:00
parent c6db72896f
commit e5ef1da160
10 changed files with 66 additions and 106 deletions
+6 -4
View File
@@ -18,14 +18,16 @@
#include <string>
#include "typing.hpp"
struct safe_string_t {
struct safe_string_t : public nanobind::object {
LIEF_PY_DEFAULT_CTOR(safe_string_t, nanobind::str);
LIEF_PY_DEFAULT_CTOR(safe_string_t, nanobind::bytes);
LIEF_PY_DEFAULT_WRAPPER(safe_string_t);
};
NB_OBJECT_DEFAULT(safe_string_t, object, "Union[str, bytes]", check)
LIEF_PY_DEFAULT_NB_CASTER(safe_string_t, "Union[str, bytes]");
static bool check(handle h) {
return true;
}
};
namespace LIEF::py {
safe_string_t safe_string(const std::string& str);