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.
This commit is contained in:
rdb 2018-12-16 11:49:38 +01:00
parent 147bac69a7
commit b11debcf3d

View File

@ -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":