Skip to content

Commit e820537

Browse files
committed
past module is not available in v2 interpreters
1 parent 7b7c4b8 commit e820537

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

test/long.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Copyright David Abrahams 2004. Distributed under the Boost
22
# Software License, Version 1.0. (See accompanying
33
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4-
from past.builtins import long
4+
import sys
5+
if (sys.version_info.major >= 3):
6+
from past.builtins import long
57
'''
68
>>> from long_ext import *
79
>>> print(new_long())
@@ -25,7 +27,7 @@ def run(args = None):
2527
if args is not None:
2628
sys.argv = args
2729
return doctest.testmod(sys.modules.get(__name__))
28-
30+
2931
if __name__ == '__main__':
3032
print("running...")
3133
import sys

test/test_builtin_converters.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Copyright David Abrahams 2004. Distributed under the Boost
22
# Software License, Version 1.0. (See accompanying
33
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4-
from past.builtins import long
4+
import sys
5+
if (sys.version_info.major >= 3):
6+
from past.builtins import long
57
r"""
68
>>> from builtin_converters_ext import *
79
@@ -74,7 +76,7 @@
7476
7577
test unsigned long values which don't fit in a signed long.
7678
strip any 'L' characters in case the platform has > 32 bit longs
77-
79+
7880
>>> hex(rewrap_value_unsigned_long(0x80000001L)).replace('L','')
7981
'0x80000001'
8082
@@ -83,7 +85,7 @@
8385
>>> rewrap_value_unsigned_long_long(42) == 42
8486
True
8587
86-
show that we have range checking.
88+
show that we have range checking.
8789
8890
>>> should_pass(rewrap_value_signed_char, _signed_values(char_size()))
8991
>>> should_pass(rewrap_value_short, _signed_values(short_size()))
@@ -140,7 +142,7 @@
140142
yo, wassup?
141143
142144
wrap strings with embedded nulls:
143-
145+
144146
>>> rewrap_value_string('yo,\0wassup?')
145147
'yo,\x00wassup?'
146148
@@ -152,7 +154,7 @@
152154
153155
Note that we can currently get a mutable pointer into an immutable
154156
Python string:
155-
157+
156158
>>> rewrap_value_mutable_cstring('hello, world')
157159
'hello, world'
158160
@@ -285,16 +287,16 @@ def run(args = None):
285287
import sys
286288
import doctest
287289
import builtin_converters_ext
288-
290+
289291
if 'rewrap_value_long_long' in dir(builtin_converters_ext):
290292
print('LONG_LONG supported, testing...')
291293
else:
292294
print('LONG_LONG not supported, skipping those tests...')
293-
295+
294296
if args is not None:
295297
sys.argv = args
296298
return doctest.testmod(sys.modules.get(__name__))
297-
299+
298300
if __name__ == '__main__':
299301
print("running...")
300302
import sys

0 commit comments

Comments
 (0)