Author corona10
Recipients corona10, eric.snow, koubaa, terry.reedy, vstinner
Date 2020-09-10.08:58:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1599728318.55.0.674187467215.issue40600@roundup.psfhosted.org>
In-reply-to
Content
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 :)
History
Date User Action Args
2020-09-10 08:58:38corona10setrecipients: + corona10, terry.reedy, vstinner, eric.snow, koubaa
2020-09-10 08:58:38corona10setmessageid: <1599728318.55.0.674187467215.issue40600@roundup.psfhosted.org>
2020-09-10 08:58:38corona10linkissue40600 messages
2020-09-10 08:58:37corona10create