mohamed koubaa <kouba...@gmail.com> added the comment:
What about a new PyModuleDef_Slot function? ``` static int my_can_create(/*need any arg??, InterpreterState, etc?*/) { if (test_global_condition()) { return -1; //Don't allow creation } return 0; //Allow creation }; static PyModuleDef_Slot signal_slots[] = { {Py_mod_exec, my_exec}, {Py_mod_can_create, my_can_create}, {0,0} }; ``` ---------- nosy: +koubaa _______________________________________ 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