diff -r c89f7c34e356 Include/pyport.h --- a/Include/pyport.h Tue Mar 17 04:32:30 2015 -0700 +++ b/Include/pyport.h Tue Mar 17 17:42:41 2015 +0100 @@ -800,6 +800,12 @@ extern pid_t forkpty(int *, char *, stru # endif /* __cplusplus */ #endif +#if defined(__cplusplus) +# define _PyBUILTIN_MODINIT_FUNC extern "C" PyObject* +#else /* __cplusplus */ +# define _PyBUILTIN_MODINIT_FUNC PyObject* +#endif /* __cplusplus */ + /* limits.h constants that may be missing */ #ifndef INT_MAX diff -r c89f7c34e356 Modules/_codecsmodule.c --- a/Modules/_codecsmodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_codecsmodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -1247,7 +1247,7 @@ static struct PyModuleDef codecsmodule = NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__codecs(void) { return PyModule_Create(&codecsmodule); diff -r c89f7c34e356 Modules/_collectionsmodule.c --- a/Modules/_collectionsmodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_collectionsmodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -1961,7 +1961,7 @@ static struct PyModuleDef _collectionsmo NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__collections(void) { PyObject *m; diff -r c89f7c34e356 Modules/_functoolsmodule.c --- a/Modules/_functoolsmodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_functoolsmodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -606,7 +606,7 @@ static struct PyModuleDef _functoolsmodu NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__functools(void) { int i; diff -r c89f7c34e356 Modules/_io/_iomodule.c --- a/Modules/_io/_iomodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_io/_iomodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -628,7 +628,7 @@ struct PyModuleDef _PyIO_Module = { (freefunc)iomodule_free, }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__io(void) { PyObject *m = PyModule_Create(&_PyIO_Module); diff -r c89f7c34e356 Modules/_localemodule.c --- a/Modules/_localemodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_localemodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -618,7 +618,7 @@ static struct PyModuleDef _localemodule NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__locale(void) { PyObject *m, *d, *x; diff -r c89f7c34e356 Modules/_operator.c --- a/Modules/_operator.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_operator.c Tue Mar 17 17:42:41 2015 +0100 @@ -936,7 +936,7 @@ static struct PyModuleDef operatormodule NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__operator(void) { PyObject *m; diff -r c89f7c34e356 Modules/_sre.c --- a/Modules/_sre.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_sre.c Tue Mar 17 17:42:41 2015 +0100 @@ -2737,7 +2737,8 @@ static struct PyModuleDef sremodule = { NULL }; -PyMODINIT_FUNC PyInit__sre(void) +_PyBUILTIN_MODINIT_FUNC +PyInit__sre(void) { PyObject* m; PyObject* d; diff -r c89f7c34e356 Modules/_stat.c --- a/Modules/_stat.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_stat.c Tue Mar 17 17:42:41 2015 +0100 @@ -504,7 +504,7 @@ static struct PyModuleDef statmodule = { NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__stat(void) { PyObject *m; diff -r c89f7c34e356 Modules/_threadmodule.c --- a/Modules/_threadmodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_threadmodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -1359,7 +1359,7 @@ static struct PyModuleDef threadmodule = }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__thread(void) { PyObject *m, *d, *timeout_max; diff -r c89f7c34e356 Modules/_tracemalloc.c --- a/Modules/_tracemalloc.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_tracemalloc.c Tue Mar 17 17:42:41 2015 +0100 @@ -1352,7 +1352,7 @@ static struct PyModuleDef module_def = { NULL, }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__tracemalloc(void) { PyObject *m; diff -r c89f7c34e356 Modules/_weakref.c --- a/Modules/_weakref.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/_weakref.c Tue Mar 17 17:42:41 2015 +0100 @@ -133,7 +133,7 @@ static struct PyModuleDef weakrefmodule NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__weakref(void) { PyObject *m; diff -r c89f7c34e356 Modules/atexitmodule.c --- a/Modules/atexitmodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/atexitmodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -323,7 +323,7 @@ static struct PyModuleDef atexitmodule = (freefunc)atexit_free }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit_atexit(void) { PyObject *m; diff -r c89f7c34e356 Modules/errnomodule.c --- a/Modules/errnomodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/errnomodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -92,7 +92,7 @@ static struct PyModuleDef errnomodule = NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit_errno(void) { PyObject *m, *d, *de; diff -r c89f7c34e356 Modules/faulthandler.c --- a/Modules/faulthandler.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/faulthandler.c Tue Mar 17 17:42:41 2015 +0100 @@ -1073,7 +1073,7 @@ static struct PyModuleDef module_def = { NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit_faulthandler(void) { return PyModule_Create(&module_def); diff -r c89f7c34e356 Modules/gcmodule.c --- a/Modules/gcmodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/gcmodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -1532,7 +1532,7 @@ static struct PyModuleDef gcmodule = { NULL /* m_free */ }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit_gc(void) { PyObject *m; diff -r c89f7c34e356 Modules/itertoolsmodule.c --- a/Modules/itertoolsmodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/itertoolsmodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -4575,7 +4575,7 @@ static struct PyModuleDef itertoolsmodul NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit_itertools(void) { int i; diff -r c89f7c34e356 Modules/posixmodule.c --- a/Modules/posixmodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/posixmodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -18384,7 +18384,7 @@ static char *have_functions[] = { }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC INITFUNC(void) { PyObject *m, *v; diff -r c89f7c34e356 Modules/pwdmodule.c --- a/Modules/pwdmodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/pwdmodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -219,7 +219,7 @@ static struct PyModuleDef pwdmodule = { }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit_pwd(void) { PyObject *m; diff -r c89f7c34e356 Modules/signalmodule.c --- a/Modules/signalmodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/signalmodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -1141,7 +1141,7 @@ static struct PyModuleDef signalmodule = NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__signal(void) { PyObject *m, *d, *x; diff -r c89f7c34e356 Modules/symtablemodule.c --- a/Modules/symtablemodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/symtablemodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -60,7 +60,7 @@ static struct PyModuleDef symtablemodule NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__symtable(void) { PyObject *m; diff -r c89f7c34e356 Modules/timemodule.c --- a/Modules/timemodule.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/timemodule.c Tue Mar 17 17:42:41 2015 +0100 @@ -1340,7 +1340,7 @@ static struct PyModuleDef timemodule = { NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit_time(void) { PyObject *m; diff -r c89f7c34e356 Modules/xxsubtype.c --- a/Modules/xxsubtype.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/xxsubtype.c Tue Mar 17 17:42:41 2015 +0100 @@ -270,7 +270,7 @@ static struct PyModuleDef xxsubtypemodul }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit_xxsubtype(void) { PyObject *m; diff -r c89f7c34e356 Modules/zipimport.c --- a/Modules/zipimport.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Modules/zipimport.c Tue Mar 17 17:42:41 2015 +0100 @@ -1467,7 +1467,7 @@ static struct PyModuleDef zipimportmodul NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit_zipimport(void) { PyObject *mod; diff -r c89f7c34e356 Objects/unicodeobject.c --- a/Objects/unicodeobject.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Objects/unicodeobject.c Tue Mar 17 17:42:41 2015 +0100 @@ -15419,7 +15419,7 @@ static struct PyModuleDef _string_module NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__string(void) { return PyModule_Create(&_string_module); diff -r c89f7c34e356 Parser/asdl_c.py --- a/Parser/asdl_c.py Tue Mar 17 04:32:30 2015 -0700 +++ b/Parser/asdl_c.py Tue Mar 17 17:42:41 2015 +0100 @@ -995,7 +995,7 @@ class ASTModuleVisitor(PickleVisitor): self.emit("static struct PyModuleDef _astmodule = {", 0) self.emit(' PyModuleDef_HEAD_INIT, "_ast"', 0) self.emit("};", 0) - self.emit("PyMODINIT_FUNC", 0) + self.emit("_PyBUILTIN_MODINIT_FUNC", 0) self.emit("PyInit__ast(void)", 0) self.emit("{", 0) self.emit("PyObject *m, *d;", 1) diff -r c89f7c34e356 Python/Python-ast.c --- a/Python/Python-ast.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Python/Python-ast.c Tue Mar 17 17:42:41 2015 +0100 @@ -6840,7 +6840,7 @@ failed: static struct PyModuleDef _astmodule = { PyModuleDef_HEAD_INIT, "_ast" }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit__ast(void) { PyObject *m, *d; diff -r c89f7c34e356 Python/_warnings.c --- a/Python/_warnings.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Python/_warnings.c Tue Mar 17 17:42:41 2015 +0100 @@ -1062,7 +1062,7 @@ static struct PyModuleDef warningsmodule }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC _PyWarnings_Init(void) { PyObject *m; diff -r c89f7c34e356 Python/import.c --- a/Python/import.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Python/import.c Tue Mar 17 17:42:41 2015 +0100 @@ -1999,7 +1999,7 @@ static struct PyModuleDef impmodule = { NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyInit_imp(void) { PyObject *m, *d; diff -r c89f7c34e356 Python/marshal.c --- a/Python/marshal.c Tue Mar 17 04:32:30 2015 -0700 +++ b/Python/marshal.c Tue Mar 17 17:42:41 2015 +0100 @@ -1813,7 +1813,7 @@ static struct PyModuleDef marshalmodule NULL }; -PyMODINIT_FUNC +_PyBUILTIN_MODINIT_FUNC PyMarshal_Init(void) { PyObject *mod = PyModule_Create(&marshalmodule);