From 3277b35183ba48f7469484c9e6e09cc1bd46aa7d Mon Sep 17 00:00:00 2001 From: "doko@ubuntu.com" Date: Wed, 8 Aug 2012 12:15:55 +0200 Subject: - Issue #11715: Fix multiarch detection without having Debian development tools (dpkg-dev) installed. --- Misc/NEWS | 3 +++ setup.py | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index 9b53ce9..53975f0 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -312,6 +312,9 @@ Tests Build ----- +- Issue #11715: Fix multiarch detection without having Debian development + tools (dpkg-dev) installed. + - Issue #15037: Build OS X installers with local copy of ncurses 5.9 libraries to avoid curses.unget_wch bug present in older versions of ncurses such as those shipped with OS X. diff --git a/setup.py b/setup.py index bc1e1bb..7f863a4 100644 --- a/setup.py +++ b/setup.py @@ -379,6 +379,27 @@ class PyBuildExt(build_ext): def add_multiarch_paths(self): # Debian/Ubuntu multiarch support. # https://wiki.ubuntu.com/MultiarchSpec + cc = sysconfig.get_config_var('CC') + tmpfile = os.path.join(self.build_temp, 'multiarch') + if not os.path.exists(self.build_temp): + os.makedirs(self.build_temp) + ret = os.system( + '%s -print-multiarch > %s 2> /dev/null' % (cc, tmpfile)) + multiarch_path_component = '' + try: + if ret >> 8 == 0: + with open(tmpfile) as fp: + multiarch_path_component = fp.readline().strip() + finally: + os.unlink(tmpfile) + + if multiarch_path_component != '': + add_dir_to_list(self.compiler.library_dirs, + '/usr/lib/' + multiarch_path_component) + add_dir_to_list(self.compiler.include_dirs, + '/usr/include/' + multiarch_path_component) + return + if not find_executable('dpkg-architecture'): return opt = '' -- cgit v0.12 From 8d4734f6b20827d369021b7cbdd36f719d41e601 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 8 Aug 2012 20:09:21 +0200 Subject: Issue #13072: Fix test_array for Windows with 16-bit wchar_t --- Lib/test/test_array.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 9385339..cbadba9 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -1029,7 +1029,7 @@ class UnicodeTest(StringTest): smallerexample = '\x01\u263a\x00\ufefe' biggerexample = '\x01\u263a\x01\ufeff' outside = str('\x33') - minitemsize = 4 + minitemsize = 2 def test_unicode(self): self.assertRaises(TypeError, array.array, 'b', 'foo') @@ -1041,7 +1041,7 @@ class UnicodeTest(StringTest): a.fromunicode('\x11abc\xff\u1234') s = a.tounicode() self.assertEqual(s, '\xa0\xc2\u1234 \x11abc\xff\u1234') - self.assertEqual(a.itemsize, 4) + self.assertEqual(a.itemsize, 2) s = '\x00="\'a\\b\x80\xff\u0000\u0001\u1234' a = array.array('u', s) -- cgit v0.12 From bded28c081fe405a382fbb6b246a55a0697cea45 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 8 Aug 2012 20:19:37 +0200 Subject: Issue #13072: Ooops, now fix test_array for Linux with 32-bit wchar_t... --- Lib/test/test_array.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index cbadba9..974e178 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -3,6 +3,7 @@ Roger E. Masse """ +import ctypes import unittest from test import support import weakref @@ -1041,7 +1042,7 @@ class UnicodeTest(StringTest): a.fromunicode('\x11abc\xff\u1234') s = a.tounicode() self.assertEqual(s, '\xa0\xc2\u1234 \x11abc\xff\u1234') - self.assertEqual(a.itemsize, 2) + self.assertEqual(a.itemsize, ctypes.sizeof(ctypes.c_wchar)) s = '\x00="\'a\\b\x80\xff\u0000\u0001\u1234' a = array.array('u', s) -- cgit v0.12 From 29650116685af6c78d85615cafbe2625e8c01af5 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 8 Aug 2012 22:37:26 +0200 Subject: regrtest: give more information when a child process fails with an error different than KeyboardInterrupt --- Lib/test/regrtest.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 15d7d0b..c9ef0ff 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -440,8 +440,11 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, args, kwargs = json.loads(a) try: result = runtest(*args, **kwargs) + except KeyboardInterrupt: + result = INTERRUPTED, '' except BaseException as e: - result = INTERRUPTED, e.__class__.__name__ + traceback.print_exc() + result = CHILD_ERROR, str(e) sys.stdout.flush() print() # Force a newline (just in case) print(json.dumps(result)) @@ -684,8 +687,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, sys.stdout.flush() sys.stderr.flush() if result[0] == INTERRUPTED: - assert result[1] == 'KeyboardInterrupt' - raise KeyboardInterrupt # What else? + raise KeyboardInterrupt if result[0] == CHILD_ERROR: raise Exception("Child error on {}: {}".format(test, result[1])) test_index += 1 -- cgit v0.12 From 22701e86d0ab332abc4a985109b9638c44371e42 Mon Sep 17 00:00:00 2001 From: Larry Hastings Date: Wed, 8 Aug 2012 14:52:22 -0700 Subject: Issue #15589: Ensure double-alignment for brute-force capi argument parser test that occasionally uses doubles. --- Modules/_testcapimodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index ca526bd..ce58651 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1210,7 +1210,7 @@ parse_tuple_and_keywords(PyObject *self, PyObject *args) int result; PyObject *return_value = NULL; - char buffers[32][8]; + double buffers[8][4]; /* double ensures alignment where necessary */ if (!PyArg_ParseTuple(args, "OOyO:parse_tuple_and_keywords", &sub_args, &sub_kwargs, -- cgit v0.12 From 9d512ab97f642215c16eace1705f585f41eb4162 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 9 Aug 2012 00:43:56 +0200 Subject: Issue #13072: Fix test_array for installation without the ctypes module --- Lib/test/test_array.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 974e178..eb6d77f 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -3,7 +3,6 @@ Roger E. Masse """ -import ctypes import unittest from test import support import weakref @@ -1033,6 +1032,16 @@ class UnicodeTest(StringTest): minitemsize = 2 def test_unicode(self): + try: + import ctypes + sizeof_wchar = ctypes.sizeof(ctypes.c_wchar) + except ImportError: + import sys + if sys.platform == 'win32': + sizeof_wchar = 2 + else: + sizeof_wchar = 4 + self.assertRaises(TypeError, array.array, 'b', 'foo') a = array.array('u', '\xa0\xc2\u1234') @@ -1042,7 +1051,7 @@ class UnicodeTest(StringTest): a.fromunicode('\x11abc\xff\u1234') s = a.tounicode() self.assertEqual(s, '\xa0\xc2\u1234 \x11abc\xff\u1234') - self.assertEqual(a.itemsize, ctypes.sizeof(ctypes.c_wchar)) + self.assertEqual(a.itemsize, sizeof_wchar) s = '\x00="\'a\\b\x80\xff\u0000\u0001\u1234' a = array.array('u', s) -- cgit v0.12