Skip to content

Commit

Permalink
Update nanobind
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Dec 10, 2024
1 parent e54ef04 commit 0ff950c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions api/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/python/src/pyIOStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ result<PyIOStream> 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);
Expand Down
7 changes: 0 additions & 7 deletions api/python/src/pyutils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::str>(nb::detail::nb_inst_name(obj.ptr()));
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Binary file not shown.

0 comments on commit 0ff950c

Please sign in to comment.