Dong-hee Na <donghee.n...@gmail.com> added the comment:
One of my opinions is that Since module object supports detecting error during Py_mod_exec, The only thing we have to do is return -1 when the module has already existed. we should define new exception type and don't have to define new slots. The pros of this method is that we don't have to modify module object and no needs to write the new PEP but the cons of this method is that we should promise the standard exception when try to create multiple instances which is not allowed. ref: https://github.com/python/cpython/blob/788b79fa7b6184221e68d4f1a3fbe0b3270693f6/Objects/moduleobject.c#L399 On the other side, defining a Py_mod_exec_once that supports execution for just once can be a way. Although the usage is little, it will be fine because the use case will exist. Please point out what I missed :) ---------- _______________________________________ 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