Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r64351:5cfb4173e757 Date: 2013-05-19 13:18 -0700 http://bitbucket.org/pypy/pypy/changeset/5cfb4173e757/
Log: merge default diff --git a/lib-python/2.7/test/test_sysconfig.py b/lib-python/2.7/test/test_sysconfig.py --- a/lib-python/2.7/test/test_sysconfig.py +++ b/lib-python/2.7/test/test_sysconfig.py @@ -7,7 +7,8 @@ import subprocess from copy import copy, deepcopy -from test.test_support import run_unittest, TESTFN, unlink, get_attribute +from test.test_support import (run_unittest, TESTFN, unlink, get_attribute, + import_module) import sysconfig from sysconfig import (get_paths, get_platform, get_config_vars, @@ -236,7 +237,10 @@ def test_get_config_h_filename(self): config_h = sysconfig.get_config_h_filename() - self.assertTrue(os.path.isfile(config_h), config_h) + # import_module skips the test when the CPython C Extension API + # appears to not be supported + self.assertTrue(os.path.isfile(config_h) or + not import_module('_testcapi'), config_h) def test_get_scheme_names(self): wanted = ('nt', 'nt_user', 'os2', 'os2_home', 'osx_framework_user', diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -124,12 +124,10 @@ __import__(name) except (ImportError, CompilationError, py.test.skip.Exception), e: errcls = e.__class__.__name__ - config.add_warning( + raise Exception( "The module %r is disabled\n" % (modname,) + "because importing %s raised %s\n" % (name, errcls) + str(e)) - raise ConflictConfigError("--withmod-%s: %s" % (modname, - errcls)) return validator else: return None diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py --- a/pypy/interpreter/test/test_app_main.py +++ b/pypy/interpreter/test/test_app_main.py @@ -1022,24 +1022,35 @@ expected_path = [str(prefix.join(subdir).ensure(dir=1)) for subdir in ('lib_pypy', 'lib-python/%s' % cpy_ver)] + # an empty directory from where we can't find the stdlib + tmp_dir = str(udir.join('tmp').ensure(dir=1)) self.w_goal_dir = self.space.wrap(goal_dir) self.w_fake_exe = self.space.wrap(str(fake_exe)) self.w_expected_path = self.space.wrap(expected_path) self.w_trunkdir = self.space.wrap(os.path.dirname(pypydir)) + self.w_tmp_dir = self.space.wrap(tmp_dir) + foo_py = prefix.join('foo.py').write("pass") self.w_foo_py = self.space.wrap(str(foo_py)) def test_setup_bootstrap_path(self): - import sys + # Check how sys.path is handled depending on if we can find a copy of + # the stdlib in setup_bootstrap_path. + import sys, os old_sys_path = sys.path[:] + old_cwd = os.getcwd() + sys.path.append(self.goal_dir) + # make sure cwd does not contain a stdlib + os.chdir(self.tmp_dir) + tmp_pypy_c = os.path.join(self.tmp_dir, 'pypy-c') try: import app_main - app_main.setup_bootstrap_path('/tmp/pypy-c') # stdlib not found + app_main.setup_bootstrap_path(tmp_pypy_c) # stdlib not found assert sys.executable == '' - assert sys.path == old_sys_path + assert sys.path == old_sys_path + [self.goal_dir] app_main.setup_bootstrap_path(self.fake_exe) assert sys.executable == self.fake_exe @@ -1052,6 +1063,7 @@ assert newpath[:len(self.expected_path)] == self.expected_path finally: sys.path[:] = old_sys_path + os.chdir(old_cwd) def test_trunk_can_be_prefix(self): import sys diff --git a/pypy/module/_rawffi/test/test__rawffi.py b/pypy/module/_rawffi/test/test__rawffi.py --- a/pypy/module/_rawffi/test/test__rawffi.py +++ b/pypy/module/_rawffi/test/test__rawffi.py @@ -232,9 +232,9 @@ import _rawffi # this should return *all* loaded libs, dlopen(NULL) dll = _rawffi.CDLL(None) - # Assume CPython, or PyPy compiled with cpyext - res = dll.ptr('Py_IsInitialized', [], 'l')() - assert res[0] == 1 + func = dll.ptr('rand', [], 'i') + res = func() + assert res[0] != 0 def test_libc_load(self): import _rawffi diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py --- a/pypy/module/micronumpy/test/test_dtypes.py +++ b/pypy/module/micronumpy/test/test_dtypes.py @@ -274,7 +274,10 @@ from numpypy import array, dtype from cPickle import loads, dumps a = array([1,2,3]) - assert a.dtype.__reduce__() == (dtype, ('i8', 0, 1), (3, '<', None, None, None, -1, -1, 0)) + if self.ptr_size == 8: + assert a.dtype.__reduce__() == (dtype, ('i8', 0, 1), (3, '<', None, None, None, -1, -1, 0)) + else: + assert a.dtype.__reduce__() == (dtype, ('i4', 0, 1), (3, '<', None, None, None, -1, -1, 0)) assert loads(dumps(a.dtype)) == a.dtype def test_pickle_record(self): diff --git a/rpython/translator/c/src/stacklet/tests.c b/rpython/translator/c/src/stacklet/tests.c --- a/rpython/translator/c/src/stacklet/tests.c +++ b/rpython/translator/c/src/stacklet/tests.c @@ -31,7 +31,7 @@ assert(status == 0); status = 1; assert(h != EMPTY_STACKLET_HANDLE); - h = stacklet_switch(thrd, h); + h = stacklet_switch(h); assert(status == 2); assert(h != EMPTY_STACKLET_HANDLE); status = 3; @@ -45,7 +45,7 @@ assert(h != EMPTY_STACKLET_HANDLE); assert(status == 1); status = 2; - h = stacklet_switch(thrd, h); + h = stacklet_switch(h); assert(status == 3); assert(h == EMPTY_STACKLET_HANDLE); } @@ -148,7 +148,7 @@ //printf("switch to %d\n", n); h = handles[n]; handles[n] = NULL; - h = stacklet_switch(thrd, h); + h = stacklet_switch(h); } //printf("back in self = %d, coming from %d\n", self, comefrom); assert(nextstep == status); _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit