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

Skip to content

Commit d3899c1

Browse files
committed
- Issue #22980: Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include
the architecture triplet in the extension name, to make it easy to test builds for different ABIs in the same working tree.
1 parent 7a80389 commit d3899c1

4 files changed

Lines changed: 509 additions & 266 deletions

File tree

Lib/test/test_sysconfig.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,19 @@ def test_SO_in_vars(self):
390390
self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
391391

392392
@unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test')
393-
def test_bitness_in_ext_suffix(self):
393+
def test_triplet_in_ext_suffix(self):
394+
import ctypes, platform, re
395+
machine = platform.machine()
394396
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+
if re.match('(aarch64|arm|mips|ppc|powerpc|s390|sparc)', machine):
398+
self.assertTrue('linux' in suffix, suffix)
399+
if re.match('(i[3-6]86|x86_64)$', 'x86_64'):
400+
if ctypes.sizeof(ctypes.c_char_p()) == 4:
401+
self.assertTrue(suffix.endswith('i386-linux-gnu.so') \
402+
or suffix.endswith('x86_64-linux-gnux32.so'),
403+
suffix)
404+
else: # 8 byte pointer size
405+
self.assertTrue(suffix.endswith('x86_64-linux-gnu.so'), suffix)
397406

398407

399408
class MakefileTests(unittest.TestCase):

Misc/NEWS

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

13+
- Issue #22980: Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include
14+
the architecture triplet in the extension name, to make it easy to test builds
15+
for different ABIs in the same working tree.
16+
1317
- Issue #22631: Added Linux-specific socket constant CAN_RAW_FD_FRAMES.
1418
Patch courtesy of Joe Jevnik.
1519

@@ -382,10 +386,6 @@ Release date: 2015-03-09
382386
Core and Builtins
383387
-----------------
384388

385-
- Issue #22980: Under Linux, C extensions now include bitness in the file
386-
name, to make it easy to test 32-bit and 64-bit builds in the same
387-
working tree.
388-
389389
- Issue #23571: PyObject_Call() and PyCFunction_Call() now raise a SystemError
390390
if a function returns a result and raises an exception. The SystemError is
391391
chained to the previous exception.

0 commit comments

Comments
 (0)