diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2015-05-26 11:57:16 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2015-05-26 11:57:16 (GMT) |
commit | 06f155f4884dff99bfd72a38d8930449a24cbf28 (patch) | |
tree | 97306a23aaae938a6ca63460b6487a36e986d69b | |
parent | c074e9d765505df971fc89e21d512b40f85e1d6b (diff) | |
parent | 55871f04bf0ac1cf0c7b1efd82780b4bf979d4f0 (diff) | |
download | cpython-06f155f4884dff99bfd72a38d8930449a24cbf28.zip cpython-06f155f4884dff99bfd72a38d8930449a24cbf28.tar.gz cpython-06f155f4884dff99bfd72a38d8930449a24cbf28.tar.bz2 |
Merge fix for issue #24285 from 3.5
-rw-r--r-- | Lib/test/test_importlib/extension/test_loader.py | 7 | ||||
-rw-r--r-- | Misc/NEWS | 6 | ||||
-rw-r--r-- | Python/importdl.c | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/Lib/test/test_importlib/extension/test_loader.py b/Lib/test/test_importlib/extension/test_loader.py index 66ac2b1..5813ade 100644 --- a/Lib/test/test_importlib/extension/test_loader.py +++ b/Lib/test/test_importlib/extension/test_loader.py @@ -170,6 +170,13 @@ class MultiPhaseExtensionModuleTests(abc.LoaderTests): loader.exec_module(module) return module + def test_load_submodule(self): + '''Test loading a simulated submodule''' + module = self.load_module_by_name('pkg.' + self.name) + self.assertIsInstance(module, types.ModuleType) + self.assertEqual(module.__name__, 'pkg.' + self.name) + self.assertEqual(module.str_const, 'something different') + def test_load_twice(self): '''Test that 2 loads result in 2 module objects''' module1 = self.load_module_by_name(self.name) @@ -22,6 +22,9 @@ Release date: 2015-07-05 Core and Builtins ----------------- +- Issue #24285: Fixed regression that prevented importing extension modules + from inside packages. Patch by Petr Viktorin. + Library ------- @@ -36,7 +39,8 @@ Core and Builtins - Issue #24276: Fixed optimization of property descriptor getter. -- Issue #24268: PEP 489: Multi-phase extension module initialization +- Issue #24268: PEP 489: Multi-phase extension module initialization. + Patch by Petr Viktorin. - Issue #23955: Add pyvenv.cfg option to suppress registry/environment lookup for generating sys.path on Windows. diff --git a/Python/importdl.c b/Python/importdl.c index bb90391..579d2c5 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -45,7 +45,7 @@ get_encoded_name(PyObject *name, const char **hook_prefix) { if (lastdot < -1) { return NULL; } else if (lastdot >= 0) { - tmp = PyUnicode_Substring(name, lastdot, name_len); + tmp = PyUnicode_Substring(name, lastdot + 1, name_len); if (tmp == NULL) return NULL; name = tmp; |