Skip to content

Commit

Permalink
Python bindings: silence SWIG 'detected a memory leak' message
Browse files Browse the repository at this point in the history
Previous workarounds (PR #8003) no longer worked with latest SWIG versions

Refs #4907
  • Loading branch information
rouault authored and github-actions[bot] committed Sep 18, 2024
1 parent 0f48711 commit 86e1ac3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions swig/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ class gdal_ext(build_ext):
# the Extension() instantiations below because we want to use the same
# logic to resolve the location of gdal-config throughout.
ext.extra_compile_args.extend(self.extra_cflags)

# Work around "swig/python detected a memory leak" bug
# Cf https://github.com/swig/swig/issues/2638#issuecomment-2345002698
if self.get_compiler() == 'msvc':
ext.extra_compile_args.append("/DSWIG_PYTHON_SILENT_MEMLEAK")
else:
ext.extra_compile_args.append("-DSWIG_PYTHON_SILENT_MEMLEAK")

return build_ext.build_extension(self, ext)


Expand Down

0 comments on commit 86e1ac3

Please sign in to comment.