mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #1172711: Add 'long long' support to the array module.
Initial patch by Oren Tirosh and Hirokazu Yamamoto.
This commit is contained in:
parent
4ad6ed7d4d
commit
1c9f0c93ad
4 changed files with 141 additions and 28 deletions
|
@ -16,6 +16,13 @@ import warnings
|
|||
import array
|
||||
from array import _array_reconstructor as array_reconstructor
|
||||
|
||||
try:
|
||||
# Try to determine availability of long long independently
|
||||
# of the array module under test
|
||||
struct.calcsize('@q')
|
||||
have_long_long = True
|
||||
except struct.error:
|
||||
have_long_long = False
|
||||
|
||||
class ArraySubclass(array.array):
|
||||
pass
|
||||
|
@ -26,6 +33,8 @@ class ArraySubclassWithKwargs(array.array):
|
|||
|
||||
tests = [] # list to accumulate all tests
|
||||
typecodes = "ubBhHiIlLfd"
|
||||
if have_long_long:
|
||||
typecodes += 'qQ'
|
||||
|
||||
class BadConstructorTest(unittest.TestCase):
|
||||
|
||||
|
@ -1205,6 +1214,18 @@ class UnsignedLongTest(UnsignedNumberTest):
|
|||
minitemsize = 4
|
||||
tests.append(UnsignedLongTest)
|
||||
|
||||
@unittest.skipIf(not have_long_long, 'need long long support')
|
||||
class LongLongTest(SignedNumberTest):
|
||||
typecode = 'q'
|
||||
minitemsize = 8
|
||||
tests.append(LongLongTest)
|
||||
|
||||
@unittest.skipIf(not have_long_long, 'need long long support')
|
||||
class UnsignedLongLongTest(UnsignedNumberTest):
|
||||
typecode = 'Q'
|
||||
minitemsize = 8
|
||||
tests.append(UnsignedLongLongTest)
|
||||
|
||||
class FPTest(NumberTest):
|
||||
example = [-42.0, 0, 42, 1e5, -1e10]
|
||||
smallerexample = [-42.0, 0, 42, 1e5, -2e10]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue