diff --git a/api/python/lief/PE.pyi b/api/python/lief/PE.pyi index 0050a737..cca9b610 100644 --- a/api/python/lief/PE.pyi +++ b/api/python/lief/PE.pyi @@ -701,7 +701,7 @@ class CodeView(Debug): class CodeViewPDB(CodeView): age: int - filename: str + filename: Union[str,bytes] signature: list[int] def __init__(self) -> None: ... @property diff --git a/api/python/src/PE/objects/debug/pyCodeViewPDB.cpp b/api/python/src/PE/objects/debug/pyCodeViewPDB.cpp index f419df50..e7d6e036 100644 --- a/api/python/src/PE/objects/debug/pyCodeViewPDB.cpp +++ b/api/python/src/PE/objects/debug/pyCodeViewPDB.cpp @@ -22,6 +22,8 @@ #include #include +#include "pySafeString.hpp" + namespace LIEF::PE::py { template<> @@ -55,7 +57,9 @@ void create(nb::module_& m) { nb::overload_cast(&CodeViewPDB::age)) .def_prop_rw("filename", - nb::overload_cast<>(&CodeViewPDB::filename, nb::const_), + [] (const CodeViewPDB& self) { + return LIEF::py::safe_string(self.filename()); + }, nb::overload_cast(&CodeViewPDB::filename), "Original pdb path")