Projects STRLCPY LIEF Commits 78fad975
🤬
  • ■ ■ ■ ■ ■
    api/python/lief/__init__.pyi
    skipped 340 lines
    341 341   def __bool__(self) -> bool: ...
    342 342   
    343 343  def current_platform() -> lief.PLATFORMS: ...
     344 +def disable_leak_warning() -> None: ...
    344 345  @overload
    345 346  def hash(arg: lief.Object, /) -> int: ...
    346 347  @overload
    skipped 43 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/pyLIEF.cpp
    skipped 145 lines
    146 146   m.attr("__is_tagged__") = bool(LIEF_TAGGED);
    147 147   m.doc() = "LIEF Python API";
    148 148   
     149 + m.def("disable_leak_warning", [] {
     150 + nb::set_leak_warnings(false);
     151 + }, R"doc(
     152 + Disable nanobind warnings about leaked objects.
     153 + For instance:
     154 + 
     155 + .. code-block:: text
     156 + 
     157 + nanobind: leaked 45 instances!
     158 + nanobind: leaked 25 types!
     159 + - leaked type "lief._lief.FORMATS"
     160 + - ... skipped remainder
     161 + nanobind: leaked 201 functions!
     162 + - leaked function ""
     163 + - leaked function "export_symbol"
     164 + - ... skipped remainder
     165 + nanobind: this is likely caused by a reference counting issue in the binding code.
     166 + )doc");
     167 + 
    149 168   LIEF::py::init_python_sink();
    150 169   
    151 170   LIEF::py::init_platforms(m);
    skipped 42 lines
  • ■ ■ ■ ■ ■ ■
    doc/sphinx/api/python/utilities.rst
    skipped 14 lines
    15 15   
    16 16  .. autofunction:: lief.is_art
    17 17   
     18 +.. autofunction:: lief.disable_leak_warning
     19 + 
    18 20   
  • ■ ■ ■ ■ ■ ■
    doc/sphinx/changelog.rst
    skipped 47 lines
    48 48   instead of ``<prefix>/share/LIEF/cmake/``
    49 49   
    50 50   
     51 +:Python Bindings:
     52 + 
     53 + * Add :func:`lief.disable_leak_warning` to disable Nanobind warning about "leaks".
     54 + 
     55 + .. warning::
     56 + 
     57 + These warnings does not necessarily mean that LIEF leak objects. These
     58 + warnings might happen in `Cyclic garbage collection <https://nanobind.readthedocs.io/en/latest/typeslots.html#cyclic-garbage-collection>`_.
     59 + 
     60 + 
     61 + 
    51 62  0.14.1 - February 11th, 2024
    52 63  ----------------------------
    53 64   
    skipped 1369 lines
Please wait...
Page is in error, reload to recover