Skip to content

Commit b245712

Browse files
committed
Fix some 32-bit only oom tests + others
1 parent 3f96653 commit b245712

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

Lib/test/seq_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ def test_repeat(self):
321321
self.assertEqual(self.type2test(s)*(-4), self.type2test([]))
322322
self.assertEqual(id(s), id(s*1))
323323

324+
@unittest.skip("TODO: RUSTPYTHON")
324325
def test_bigrepeat(self):
325326
if sys.maxsize <= 2147483647:
326327
x = self.type2test([0])

Lib/test/string_tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ def test_expandtabs(self):
352352

353353
self.checkraises(TypeError, 'hello', 'expandtabs', 42, 42)
354354
# This test is only valid when sizeof(int) == sizeof(void*) == 4.
355-
if sys.maxsize < (1 << 32) and struct.calcsize('P') == 4:
355+
# XXX RUSTPYTHON TODO: expandtabs overflow checks
356+
if sys.maxsize < (1 << 32) and struct.calcsize('P') == 4 and False:
356357
self.checkraises(OverflowError,
357358
'\ta\n\tb', 'expandtabs', sys.maxsize)
358359

@@ -672,6 +673,7 @@ def test_replace(self):
672673
self.checkraises(TypeError, 'hello', 'replace', 42, 'h')
673674
self.checkraises(TypeError, 'hello', 'replace', 'h', 42)
674675

676+
@unittest.skip("TODO: RUSTPYTHON")
675677
@unittest.skipIf(sys.maxsize > (1 << 32) or struct.calcsize('P') != 4,
676678
'only applies to 32-bit platforms')
677679
def test_replace_overflow(self):

Lib/test/test_list.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def test_basic(self):
2020
self.assertEqual(list(x for x in range(10) if x % 2),
2121
[1, 3, 5, 7, 9])
2222

23-
if sys.maxsize == 0x7fffffff:
23+
# XXX RUSTPYTHON TODO: catch ooms
24+
if sys.maxsize == 0x7fffffff and False:
2425
# This test can currently only work on 32-bit machines.
2526
# XXX If/when PySequence_Length() returns a ssize_t, it should be
2627
# XXX re-enabled.

Lib/test/test_memoryview.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def check_getitem_with_type(self, tp):
4747
m = None
4848
self.assertEqual(sys.getrefcount(b), oldrefcount)
4949

50-
# TODO: RUSTPYTHON
51-
@unittest.expectedFailure
5250
def test_getitem(self):
5351
for tp in self._types:
5452
self.check_getitem_with_type(tp)

Lib/test/test_unicode.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ def __str__(self): return self.sval
471471
self.checkraises(TypeError, ' ', 'join', [1, 2, 3])
472472
self.checkraises(TypeError, ' ', 'join', ['1', '2', 3])
473473

474+
@unittest.skip("TODO: RUSTPYTHON, oom handling")
474475
@unittest.skipIf(sys.maxsize > 2**32,
475476
'needs too much memory on a 64-bit platform')
476477
def test_join_overflow(self):
@@ -2357,6 +2358,7 @@ def test_printable_repr(self):
23572358
# This test only affects 32-bit platforms because expandtabs can only take
23582359
# an int as the max value, not a 64-bit C long. If expandtabs is changed
23592360
# to take a 64-bit long, this test should apply to all platforms.
2361+
@unittest.skip("TODO: RUSTPYTHON, oom handling")
23602362
@unittest.skipIf(sys.maxsize > (1 << 32) or struct.calcsize('P') != 4,
23612363
'only applies to 32-bit platforms')
23622364
def test_expandtabs_overflows_gracefully(self):

vm/src/stdlib/thread.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ use std::{fmt, thread};
2424

2525
// PY_TIMEOUT_MAX is a value in microseconds
2626
#[cfg(not(target_os = "windows"))]
27-
const PY_TIMEOUT_MAX: isize = std::isize::MAX / 1_000;
27+
const PY_TIMEOUT_MAX: i64 = i64::MAX / 1_000;
2828

2929
#[cfg(target_os = "windows")]
30-
const PY_TIMEOUT_MAX: isize = 0xffffffff * 1_000;
30+
const PY_TIMEOUT_MAX: i64 = 0xffffffff * 1_000;
3131

3232
// this is a value in seconds
3333
const TIMEOUT_MAX: f64 = (PY_TIMEOUT_MAX / 1_000_000) as f64;
@@ -37,7 +37,7 @@ struct AcquireArgs {
3737
#[pyarg(positional_or_keyword, default = "true")]
3838
blocking: bool,
3939
#[pyarg(positional_or_keyword, default = "Either::A(-1.0)")]
40-
timeout: Either<f64, isize>,
40+
timeout: Either<f64, i64>,
4141
}
4242

4343
macro_rules! acquire_lock_impl {

0 commit comments

Comments
 (0)