diff -r 65fa067ca731 Lib/test/test_importlib/test_api.py --- a/Lib/test/test_importlib/test_api.py Fri Oct 18 17:17:31 2013 +0300 +++ b/Lib/test/test_importlib/test_api.py Fri Oct 18 10:30:59 2013 -0400 @@ -1,7 +1,9 @@ from . import util +frozen_init, source_init = util.import_importlib('importlib') +frozen_machinery, source_machinery = util.import_importlib('importlib.machinery') + import importlib -from importlib import _bootstrap from importlib import machinery import sys from test import support @@ -9,7 +11,7 @@ import unittest -class ImportModuleTests(unittest.TestCase): +class ImportModuleTests: """Test importlib.import_module.""" @@ -17,7 +19,7 @@ # Test importing a top-level module. with util.mock_modules('top_level') as mock: with util.import_state(meta_path=[mock]): - module = importlib.import_module('top_level') + module = self.init.import_module('top_level') self.assertEqual(module.__name__, 'top_level') def test_absolute_package_import(self): @@ -27,7 +29,7 @@ name = '{0}.mod'.format(pkg_name) with util.mock_modules(pkg_long_name, name) as mock: with util.import_state(meta_path=[mock]): - module = importlib.import_module(name) + module = self.init.import_module(name) self.assertEqual(module.__name__, name) def test_shallow_relative_package_import(self): @@ -39,17 +41,17 @@ relative_name = '.{0}'.format(module_name) with util.mock_modules(pkg_long_name, absolute_name) as mock: with util.import_state(meta_path=[mock]): - importlib.import_module(pkg_name) - module = importlib.import_module(relative_name, pkg_name) + self.init.import_module(pkg_name) + module = self.init.import_module(relative_name, pkg_name) self.assertEqual(module.__name__, absolute_name) def test_deep_relative_package_import(self): modules = ['a.__init__', 'a.b.__init__', 'a.c'] with util.mock_modules(*modules) as mock: with util.import_state(meta_path=[mock]): - importlib.import_module('a') - importlib.import_module('a.b') - module = importlib.import_module('..c', 'a.b') + self.init.import_module('a') + self.init.import_module('a.b') + module = self.init.import_module('..c', 'a.b') self.assertEqual(module.__name__, 'a.c') def test_absolute_import_with_package(self): @@ -60,15 +62,15 @@ name = '{0}.mod'.format(pkg_name) with util.mock_modules(pkg_long_name, name) as mock: with util.import_state(meta_path=[mock]): - importlib.import_module(pkg_name) - module = importlib.import_module(name, pkg_name) + self.init.import_module(pkg_name) + module = self.init.import_module(name, pkg_name) self.assertEqual(module.__name__, name) def test_relative_import_wo_package(self): # Relative imports cannot happen without the 'package' argument being # set. with self.assertRaises(TypeError): - importlib.import_module('.support') + self.init.import_module('.support') def test_loaded_once(self): @@ -85,9 +87,15 @@ modules = ['a.__init__', 'a.b'] with util.mock_modules(*modules, module_code=code) as mock: with util.import_state(meta_path=[mock]): - importlib.import_module('a.b') + self.init.import_module('a.b') self.assertEqual(b_load_count, 1) +class Frozen_ImportModuleTests(ImportModuleTests, unittest.TestCase): + init = frozen_init + +class Source_ImportModuleTests(ImportModuleTests, unittest.TestCase): + init = source_init + class FindLoaderTests(unittest.TestCase): diff -r 65fa067ca731 Modules/socketmodule.c --- a/Modules/socketmodule.c Fri Oct 18 17:17:31 2013 +0300 +++ b/Modules/socketmodule.c Fri Oct 18 10:30:59 2013 -0400 @@ -840,7 +840,7 @@ return siz; } /* special-case broadcast - inet_addr() below can return INADDR_NONE for - * this */ + * this */ if (strcmp(name, "255.255.255.255") == 0 || strcmp(name, "") == 0) { struct sockaddr_in *sin; @@ -901,7 +901,7 @@ #endif return 4; } - } + } #endif /* HAVE_INET_PTON */ /* perform a name resolution */ @@ -1916,8 +1916,11 @@ sizeof(cmsgh->cmsg_len)); /* Note that POSIX allows msg_controllen to be of signed type. */ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wtautological-compare" if (cmsgh == NULL || msg->msg_control == NULL || msg->msg_controllen < 0) return 0; + #pragma clang diagnostic pop if (space < cmsg_len_end) space = cmsg_len_end; cmsg_offset = (char *)cmsgh - (char *)msg->msg_control; @@ -4702,7 +4705,7 @@ /* On UNIX, dup can be used to duplicate the file descriptor of a socket */ newfd = _Py_dup(fd); if (newfd == INVALID_SOCKET) - return NULL; + return NULL; #endif newfdobj = PyLong_FromSocket_t(newfd);