Visitar URL original
Turn off leak warnings for ft2font only · matplotlib/matplotlib@275423c · GitHub
Skip to content

Commit 275423c

Browse files
committed
Turn off leak warnings for ft2font only
1 parent cd75119 commit 275423c

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/ft2font_wrapper.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,11 @@ NB_MODULE(ft2font, m)
16281628
{
16291629
FT_Library ft2Library = nullptr;
16301630

1631+
// FT2Font objects are frequently cached via functools.lru_cache.
1632+
// nanobind's atexit handler can run before these caches are cleared.
1633+
// This results in leak warnings that are false-positives.
1634+
nb::set_leak_warnings(false);
1635+
16311636
if (FT_Init_FreeType(&ft2Library)) { // initialize library
16321637
throw std::runtime_error("Could not initialize the freetype2 library");
16331638
}

‎src/meson.build‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ extension_data = {
6565
'-DFREETYPE_BUILD_TYPE="@0@"'.format(
6666
freetype_dep.type_name() == 'internal' ? 'local' : 'system',
6767
),
68+
'-DNB_DOMAIN=matplotlib_ft2font'
6869
],
6970
'link_args': host_machine.system() == 'darwin' ? ['-Wl,-ld_classic'] : [],
7071
},

0 commit comments

Comments
 (0)