From 52e29072e1e4dd247bebb571a360baa0e9b79e72 Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Fri, 13 Jan 2017 10:38:09 +0000 Subject: [PATCH 1/2] Issue #22980: Skip a sysconfig test if _ctypes is not available. Extracted from revision a1daf2d289ad by Zachary Ware. --- Lib/test/test_sysconfig.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index a23bf06af8f..38306790e42 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -5,7 +5,8 @@ import subprocess import shutil from copy import copy -from test.support import (run_unittest, TESTFN, unlink, check_warnings, +from test.support import (run_unittest, + import_module, TESTFN, unlink, check_warnings, captured_stdout, skip_unless_symlink, change_cwd) import sysconfig @@ -387,7 +388,8 @@ class TestSysConfig(unittest.TestCase): @unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test') def test_triplet_in_ext_suffix(self): - import ctypes, platform, re + ctypes = import_module('ctypes') + import platform, re machine = platform.machine() suffix = sysconfig.get_config_var('EXT_SUFFIX') if re.match('(aarch64|arm|mips|ppc|powerpc|s390|sparc)', machine): From b71c0956d0904cfdc271cd10d40385c730cf8bcb Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Thu, 12 Jan 2017 11:54:59 +0000 Subject: [PATCH 2/2] Issues #1621, #29145: Test for str.join() overflow --- Lib/test/test_unicode.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index f696a5bacf0..3136ea1a1ba 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -464,6 +464,13 @@ class UnicodeTest(string_tests.CommonTest, self.checkraises(TypeError, ' ', 'join', [1, 2, 3]) self.checkraises(TypeError, ' ', 'join', ['1', '2', 3]) + @unittest.skipIf(sys.maxsize > 2**32, + 'needs too much memory on a 64-bit platform') + def test_join_overflow(self): + size = int(sys.maxsize**0.5) + 1 + seq = ('A' * size,) * size + self.assertRaises(OverflowError, ''.join, seq) + def test_replace(self): string_tests.CommonTest.test_replace(self)