Skip to content

Commit

Permalink
Merge pull request #10831 from rouault/workaround_4907
Browse files Browse the repository at this point in the history
Python bindings: silence SWIG 'detected a memory leak' message
  • Loading branch information
rouault committed Sep 18, 2024
2 parents e2a3b9f + 212543d commit 39c1842
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 @@ -321,6 +321,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 39c1842

Please sign in to comment.