Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r70636:6dac6407412f Date: 2014-04-15 15:08 +0200 http://bitbucket.org/pypy/pypy/changeset/6dac6407412f/
Log: Test and fix: submodules of built-in modules had their classes incorrectly reported as belonging to the base module. diff --git a/pypy/interpreter/mixedmodule.py b/pypy/interpreter/mixedmodule.py --- a/pypy/interpreter/mixedmodule.py +++ b/pypy/interpreter/mixedmodule.py @@ -14,6 +14,7 @@ # after startup(). w_initialdict = None lazy = False + submodule_name = None def __init__(self, space, w_name): """ NOT_RPYTHON """ @@ -31,6 +32,8 @@ space = self.space name = space.unwrap(self.w_name) for sub_name, module_cls in self.submodules.iteritems(): + if module_cls.submodule_name is None: + module_cls.submodule_name = sub_name module_name = space.wrap("%s.%s" % (name, sub_name)) m = module_cls(space, module_name) m.install() @@ -134,6 +137,8 @@ cls.loaders = loaders = {} pkgroot = cls.__module__ appname = cls.get_applevel_name() + if cls.submodule_name is not None: + appname += '.%s' % (cls.submodule_name,) for name, spec in cls.interpleveldefs.items(): loaders[name] = getinterpevalloader(pkgroot, spec) for name, spec in cls.appleveldefs.items(): diff --git a/pypy/module/__pypy__/test/test_signal.py b/pypy/module/__pypy__/test/test_signal.py --- a/pypy/module/__pypy__/test/test_signal.py +++ b/pypy/module/__pypy__/test/test_signal.py @@ -8,6 +8,7 @@ def test_signal(self): from __pypy__ import thread + assert type(thread.signals_enabled).__module__ == '__pypy__.thread' with thread.signals_enabled: pass # assert did not crash _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit