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

Skip to content

Commit 5bd7bf5

Browse files
committed
Issue #22980: Under Linux, C extensions now include bitness in the file name,
to make it easy to test 32-bit and 64-bit builds in the same working tree.
1 parent af098a2 commit 5bd7bf5

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

Lib/test/test_sysconfig.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,12 @@ def test_SO_in_vars(self):
389389
self.assertIsNotNone(vars['SO'])
390390
self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
391391

392+
@unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test')
393+
def test_bitness_in_ext_suffix(self):
394+
suffix = sysconfig.get_config_var('EXT_SUFFIX')
395+
bitness = '-32b' if sys.maxsize < 2**32 else '-64b'
396+
self.assertTrue(suffix.endswith(bitness + '.so'), suffix)
397+
392398

393399
class MakefileTests(unittest.TestCase):
394400

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Release date: 2015-03-08
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #22980: Under Linux, C extensions now include bitness in the file
14+
name, to make it easy to test 32-bit and 64-bit builds in the same
15+
working tree.
16+
1317
- Issue #23571: PyObject_Call() and PyCFunction_Call() now raise a SystemError
1418
if a function returns a result and raises an exception. The SystemError is
1519
chained to the previous exception.

configure

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14200,7 +14200,15 @@ $as_echo_n "checking ABIFLAGS... " >&6; }
1420014200
$as_echo "$ABIFLAGS" >&6; }
1420114201
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5
1420214202
$as_echo_n "checking SOABI... " >&6; }
14203-
SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}
14203+
14204+
case $ac_sys_system in
14205+
Linux*|GNU*)
14206+
BITNESS_SUFFIX=-$(($ac_cv_sizeof_void_p * 8))b;;
14207+
*)
14208+
BITNESS_SUFFIX=;;
14209+
esac
14210+
SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${BITNESS_SUFFIX}
14211+
1420414212
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5
1420514213
$as_echo "$SOABI" >&6; }
1420614214

configure.ac

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4175,7 +4175,15 @@ AC_SUBST(SOABI)
41754175
AC_MSG_CHECKING(ABIFLAGS)
41764176
AC_MSG_RESULT($ABIFLAGS)
41774177
AC_MSG_CHECKING(SOABI)
4178-
SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}
4178+
4179+
case $ac_sys_system in
4180+
Linux*|GNU*)
4181+
BITNESS_SUFFIX=-$(($ac_cv_sizeof_void_p * 8))b;;
4182+
*)
4183+
BITNESS_SUFFIX=;;
4184+
esac
4185+
SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${BITNESS_SUFFIX}
4186+
41794187
AC_MSG_RESULT($SOABI)
41804188

41814189
AC_SUBST(EXT_SUFFIX)

0 commit comments

Comments
 (0)