Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40bbb9b

Browse files
committed
Ensure that PY_ARRAY_UNIQUE_SYMBOL is uniquely defined for each extension.
By using a unique symbol for each extension we prevent multiple definition linking errors which arise when statically linking a Python interpreter. Closes gh-2039.
1 parent b02b701 commit 40bbb9b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

setupext.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,12 @@ def check(self):
648648
def add_flags(self, ext):
649649
import numpy
650650

651+
# Ensure that PY_ARRAY_UNIQUE_SYMBOL is uniquely defined for
652+
# each extension
653+
array_api_name = 'MPL_' + ext.name.replace('.', '_') + '_ARRAY_API'
654+
651655
ext.include_dirs.append(numpy.get_include())
652-
ext.define_macros.append(('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API'))
656+
ext.define_macros.append(('PY_ARRAY_UNIQUE_SYMBOL', array_api_name))
653657

654658

655659
class CXX(SetupPackage):

0 commit comments

Comments
 (0)