aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-04-18 22:27:09 -0400
committerXavier Claessens <xclaesse@gmail.com>2022-05-09 10:49:04 -0400
commitaa874ea0d020aee90595c2adfb43866fcaabfdb7 (patch)
tree2ac79d646259bfb338ccc3ccbf2cd2fc80b30296 /mesonbuild
parent7c4087ace5b3b1c8669d7afd2b6fbcc0c816f1d4 (diff)
downloadmeson-aa874ea0d020aee90595c2adfb43866fcaabfdb7.zip
meson-aa874ea0d020aee90595c2adfb43866fcaabfdb7.tar.gz
meson-aa874ea0d020aee90595c2adfb43866fcaabfdb7.tar.bz2
python module: default extensions to hidden symbol visibility
python compiled extensions should never need to expose any symbol other than PyInit_* which is declared with default visibility via PyMODINIT_FUNC on supported compilers. Thus, a reasonably sane default is to mark any other symbols as hidden, while still respecting any manually specified visibility. Gate this on the version of python itself, as not all versions decorate PyMODINIT_FUNC properly.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/modules/python.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 324dfc8..1be9acf 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -533,6 +533,10 @@ class PythonInstallation(ExternalProgramHolder):
kwargs['name_prefix'] = ''
kwargs['name_suffix'] = suffix
+ if 'gnu_symbol_visibility' not in kwargs and \
+ (self.is_pypy or mesonlib.version_compare(self.version, '>=3.9')):
+ kwargs['gnu_symbol_visibility'] = 'inlineshidden'
+
return self.interpreter.func_shared_module(None, args, kwargs)
@disablerIfNotFound