Make typing stubs more accurate

This commit is contained in:
Romain Thomas
2023-10-21 05:47:32 +02:00
parent a27bd6a644
commit 2a2c56a173
32 changed files with 337 additions and 165 deletions
+2 -2
View File
@@ -17,10 +17,10 @@
#include "pyLIEF.hpp"
namespace LIEF::py {
nb::object safe_string(const std::string& str) {
safe_string_t safe_string(const std::string& str) {
nb::bytes str_bytes(str.c_str(), str.size());
try {
return str_bytes.attr("decode")("utf8");
return nb::str(str_bytes.attr("decode")("utf8"));
} catch (const std::exception& e) {
return str_bytes;
}