[Python-checkins] gh-106210 Remove Emscripten import trampoline (#106211)
brettcannon
webhook-mailer at python.org
Thu Jun 29 20:20:52 EDT 2023
https://github.com/python/cpython/commit/e7bc8d16364bde54487eab349a29d58345e35f28
commit: e7bc8d16364bde54487eab349a29d58345e35f28
branch: main
author: Hood Chatham <roberthoodchatham at gmail.com>
committer: brettcannon <brett at python.org>
date: 2023-06-29T17:20:49-07:00
summary:
gh-106210 Remove Emscripten import trampoline (#106211)
It's no longer necessary.
Co-authored-by: Brett Cannon <brett at python.org>
files:
A Misc/NEWS.d/next/Core and Builtins/2023-06-28-13-19-20.gh-issue-106210.oE7VMn.rst
M Python/import.c
M Python/importdl.c
M Python/importdl.h
diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-06-28-13-19-20.gh-issue-106210.oE7VMn.rst b/Misc/NEWS.d/next/Core and Builtins/2023-06-28-13-19-20.gh-issue-106210.oE7VMn.rst
new file mode 100644
index 0000000000000..fde549d21e440
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2023-06-28-13-19-20.gh-issue-106210.oE7VMn.rst
@@ -0,0 +1 @@
+Removed Emscripten import trampoline as it was no longer necessary for Pyodide.
diff --git a/Python/import.c b/Python/import.c
index b3699bdec994d..324fe3812bdd4 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -839,16 +839,6 @@ _PyImport_ClearExtension(PyObject *name, PyObject *filename)
}
-/*******************/
-
-#if defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE)
-#include <emscripten.h>
-EM_JS(PyObject*, _PyImport_InitFunc_TrampolineCall, (PyModInitFunction func), {
- return wasmTable.get(func)();
-});
-#endif // __EMSCRIPTEN__ && PY_CALL_TRAMPOLINE
-
-
/*****************************/
/* single-phase init modules */
/*****************************/
@@ -1285,7 +1275,7 @@ import_find_extension(PyThreadState *tstate, PyObject *name,
else {
if (def->m_base.m_init == NULL)
return NULL;
- mod = _PyImport_InitFunc_TrampolineCall(def->m_base.m_init);
+ mod = def->m_base.m_init();
if (mod == NULL)
return NULL;
if (PyObject_SetItem(modules, name, mod) == -1) {
@@ -1400,7 +1390,7 @@ create_builtin(PyThreadState *tstate, PyObject *name, PyObject *spec)
/* Cannot re-init internal module ("sys" or "builtins") */
return import_add_module(tstate, name);
}
- mod = _PyImport_InitFunc_TrampolineCall(*p->initfunc);
+ mod = (*p->initfunc)();
if (mod == NULL) {
return NULL;
}
diff --git a/Python/importdl.c b/Python/importdl.c
index 3a3a30ddbdcdb..eb6b808ecba1d 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -166,7 +166,7 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp)
/* Package context is needed for single-phase init */
oldcontext = _PyImport_SwapPackageContext(newcontext);
- m = _PyImport_InitFunc_TrampolineCall(p0);
+ m = p0();
_PyImport_SwapPackageContext(oldcontext);
if (m == NULL) {
diff --git a/Python/importdl.h b/Python/importdl.h
index 26d18b626df05..9171adc277068 100644
--- a/Python/importdl.h
+++ b/Python/importdl.h
@@ -12,12 +12,6 @@ extern PyObject *_PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *);
typedef PyObject *(*PyModInitFunction)(void);
-#if defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE)
-extern PyObject *_PyImport_InitFunc_TrampolineCall(PyModInitFunction func);
-#else
-#define _PyImport_InitFunc_TrampolineCall(func) (func)()
-#endif
-
/* Max length of module suffix searched for -- accommodates "module.slb" */
#define MAXSUFFIXSIZE 12
More information about the Python-checkins
mailing list