diff --git a/api/python/CMakeLists.txt b/api/python/CMakeLists.txt index 265161f4a3..44167505df 100644 --- a/api/python/CMakeLists.txt +++ b/api/python/CMakeLists.txt @@ -23,8 +23,8 @@ endif() if (LIEF_EXTERNAL_NANOBINDS) find_package(nanobind REQUIRED) else() - set(NANOBIND_VERSION 2.2.0.r27.g070f0ce) - set(NANOBIND_SHA256 SHA256=7dc0ad8b2f4baff427b6e829b029c422d80d27833732561478b7d262f15ac394) + set(NANOBIND_VERSION 2.4.0.r9.g81da6e9) + set(NANOBIND_SHA256 SHA256=8c319ad628dd092f98d345cc92e4b670c8538cc01ff8dde9be186987e7fe703f) set(NANOBIND_URL "${THIRD_PARTY_DIRECTORY}/nanobind-${NANOBIND_VERSION}.zip" CACHE STRING "URL to the Nanobind") FetchContent_Declare(nanobind diff --git a/api/python/src/pyIOStream.cpp b/api/python/src/pyIOStream.cpp index 8825ef93ba..98f2042970 100644 --- a/api/python/src/pyIOStream.cpp +++ b/api/python/src/pyIOStream.cpp @@ -29,7 +29,7 @@ result PyIOStream::from_python(nb::object object) { const nb::module_ mod_io = nb::module_::import_("io"); const nb::object IOBase = mod_io.attr("IOBase"); - if (!isinstance(object, IOBase)) { + if (!nb::isinstance(object, IOBase)) { logging::log(logging::LEVEL::ERR, "The provided io object does not sub-class io.IOBase"); return make_error_code(lief_errors::read_error); diff --git a/api/python/src/pyutils.hpp b/api/python/src/pyutils.hpp index 9d1b53760f..ba04d8044c 100644 --- a/api/python/src/pyutils.hpp +++ b/api/python/src/pyutils.hpp @@ -9,13 +9,6 @@ namespace nb = nanobind; namespace LIEF::py { -inline bool isinstance(nb::handle obj, nb::handle type) { - const auto result = PyObject_IsInstance(obj.ptr(), type.ptr()); - if (result == -1) { - nb::detail::raise_python_error(); - } - return result != 0; -} inline std::string type2str(nb::object obj) { auto pytype = nb::steal(nb::detail::nb_inst_name(obj.ptr())); diff --git a/doc/sphinx/changelog.rst b/doc/sphinx/changelog.rst index 4f38915f18..c554f244fe 100644 --- a/doc/sphinx/changelog.rst +++ b/doc/sphinx/changelog.rst @@ -198,7 +198,7 @@ :Python Bindings: - * Upgrade nanobind from ``1.8.0`` to ``2.2.0`` + * Upgrade nanobind from ``1.8.0`` to ``2.4.0`` * ``*.pyi`` stubs are now generated by nanobind (replacing mypy's stugen) :Dependencies: diff --git a/third-party/nanobind-2.2.0.r27.g070f0ce.zip b/third-party/nanobind-2.4.0.r9.g81da6e9.zip similarity index 90% rename from third-party/nanobind-2.2.0.r27.g070f0ce.zip rename to third-party/nanobind-2.4.0.r9.g81da6e9.zip index 68c0db2221..803d33bf88 100644 Binary files a/third-party/nanobind-2.2.0.r27.g070f0ce.zip and b/third-party/nanobind-2.4.0.r9.g81da6e9.zip differ