From 5ab9132621ca24a66b779b68a1da7e4354c3cb93 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Fri, 19 Dec 2008 16:50:47 -0800 Subject: [PATCH] Set module name for Spam/__init__.pyx to Spam. --- Cython/Compiler/Symtab.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 0f3388d1..ee9e8b7e 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -805,7 +805,12 @@ class ModuleScope(Scope): self.parent_module = parent_module outer_scope = context.find_submodule("__builtin__") Scope.__init__(self, name, outer_scope, parent_module) - self.module_name = name + if name != "__init__": + self.module_name = name + else: + # Treat Spam/__init__.pyx specially, so that when Python loads + # Spam/__init__.so, initSpam() is defined. + self.module_name = parent_module.module_name self.context = context self.module_cname = Naming.module_cname self.module_dict_cname = Naming.moddict_cname -- 2.26.2