From b11debcf3dcb7471533efb6c5fd8611e43904857 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 16 Dec 2018 11:49:38 +0100 Subject: [PATCH] pfreeze: fixes for Python 3.7 See python/cpython#5432 - imp module now has the proper name The DL_IMPORT and DL_EXPORT macros seem to have been removed. --- direct/src/showutil/FreezeTool.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index aafbc24124..6114692092 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -42,10 +42,11 @@ builtinInitFuncs = { '__builtin__': None, 'sys': None, 'exceptions': None, - '_imp': 'PyInit_imp', '_warnings': '_PyWarnings_Init', 'marshal': 'PyMarshal_Init', } +if sys.version_info < (3, 7): + builtinInitFuncs['_imp'] = 'PyInit_imp' # These are missing modules that we've reported already this session. reportedMissing = {} @@ -256,7 +257,7 @@ frozenMainCode = """ extern void PyWinFreeze_ExeInit(void); extern void PyWinFreeze_ExeTerm(void); -extern DL_IMPORT(int) PyImport_ExtendInittab(struct _inittab *newtab); +extern PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); #endif /* Main program */ @@ -1394,7 +1395,7 @@ class Freezer: libName = module.split('.')[-1] initFunc = builtinInitFuncs.get(module, 'PyInit_' + libName) if initFunc: - text += 'extern DL_IMPORT(PyObject) *%s(void);\n' % (initFunc) + text += 'extern PyAPI_FUNC(PyObject) *%s(void);\n' % (initFunc) text += '\n' if sys.platform == "win32": @@ -1417,7 +1418,7 @@ class Freezer: libName = module.split('.')[-1] initFunc = builtinInitFuncs.get(module, 'init' + libName) if initFunc: - text += 'extern DL_IMPORT(void) %s(void);\n' % (initFunc) + text += 'extern PyAPI_FUNC(void) %s(void);\n' % (initFunc) text += '\n' if sys.platform == "win32":