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

Skip to content

Commit 094d0e0

Browse files
author
Stefan Krah
committed
Issue #14779: Do not use get_config_var('SIZEOF_VOID_P') on OS X 64-/32-bit
universal: it returns a meaningless result. Use sys.maxsize instead of platform.architecture as a fallback. Patch by Ned Deily.
1 parent 04b2e69 commit 094d0e0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/test/test_buffer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from itertools import permutations, product
1717
from random import randrange, sample, choice
1818
from sysconfig import get_config_var
19-
from platform import architecture
2019
import warnings
2120
import sys, array, io
2221
from decimal import Decimal
@@ -748,9 +747,10 @@ def ndarray_print(nd):
748747
class TestBufferProtocol(unittest.TestCase):
749748

750749
def setUp(self):
751-
self.sizeof_void_p = get_config_var('SIZEOF_VOID_P')
750+
self.sizeof_void_p = get_config_var('SIZEOF_VOID_P') \
751+
if sys.platform != 'darwin' else None
752752
if not self.sizeof_void_p:
753-
self.sizeof_void_p = 8 if architecture()[0] == '64bit' else 4
753+
self.sizeof_void_p = 8 if sys.maxsize > 2**32 else 4
754754

755755
def verify(self, result, obj=-1,
756756
itemsize={1}, fmt=-1, readonly={1},

0 commit comments

Comments
 (0)