From: Tarek Ziade Date: Sat, 21 May 2011 19:48:04 +0000 (+0200) Subject: fixed the export symbols for the win32 linker X-Git-Tag: v3.3.0a1~2202 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76ad4f0ec9be19ccd341bb0989d8de08671d29f5;p=python fixed the export symbols for the win32 linker --- diff --git a/Lib/packaging/command/build_ext.py b/Lib/packaging/command/build_ext.py index 9b710411ca..7803d01821 100644 --- a/Lib/packaging/command/build_ext.py +++ b/Lib/packaging/command/build_ext.py @@ -589,7 +589,7 @@ class build_ext(Command): provided, "init" + module_name. Only relevant on Windows, where the .pyd file (DLL) must export the module "init" function. """ - initfunc_name = "init" + ext.name.split('.')[-1] + initfunc_name = "PyInit_" + ext.name.split('.')[-1] if initfunc_name not in ext.export_symbols: ext.export_symbols.append(initfunc_name) return ext.export_symbols diff --git a/Lib/packaging/tests/test_command_build_ext.py b/Lib/packaging/tests/test_command_build_ext.py index 2d798422b2..9dfa26b1e1 100644 --- a/Lib/packaging/tests/test_command_build_ext.py +++ b/Lib/packaging/tests/test_command_build_ext.py @@ -239,7 +239,7 @@ class BuildExtTestCase(support.TempdirManager, def test_get_outputs(self): tmp_dir = self.mkdtemp() c_file = os.path.join(tmp_dir, 'foo.c') - self.write_file(c_file, 'void initfoo(void) {};\n') + self.write_file(c_file, 'void PyInit_foo(void) {};\n') ext = Extension('foo', [c_file], optional=False) dist = Distribution({'name': 'xx', 'ext_modules': [ext]})