Petr Viktorin <encu...@gmail.com> added the comment:
Is it really necessary to add a slot/flag for this? It can be done in about 10 lines as below, without complications like a global (or per-interpreter) registry of singleton modules. Are there many modules that need to be per-interpreter singletons, but may be loaded in multiple interpreters? In my experience, it is really hard to ensure modules behave that way; if (if!) we need to add a dedicated API for this, I'd go for once-per-process. static int loaded = 0; static int exec_module(PyObject* module) { if (loaded) { PyErr_SetString(PyExc_ImportError, "cannot load module more than once per process"); return -1; } loaded = 1; // ... rest of initialization } ---------- nosy: +petr.viktorin _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40600> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com