[issue30403] PEP 547: Running extension modules using -m switch

2017-09-09 Thread Stefan Behnel
Stefan Behnel added the comment: I'm a bit torn on this. On the one hand, it's basically saying, "Cython is probably going to do it right anyway, so let's just assume it does". That's nice, and might be applicable to other cases as well. But that also feels like it could need some kind of

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-08 Thread Marcel Plch
Marcel Plch added the comment: I have made a patch both for cython and cpython implementing a way to use Py_mod_create in cython. Basically module def that specifies a new "Py_mod_cython" slot are excluded from the rule of no module creation, so these modules can be executed directly even

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-07 Thread Petr Viktorin
Petr Viktorin added the comment: Alright, that makes sense. Thanks for the feedback! Please give us some time for an updated proposal/implementation. I'm going on vacation, so expect about a week. -- ___ Python tracker

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-07 Thread Stefan Behnel
Stefan Behnel added the comment: I was kinda guessing that modifying the slot list wasn't a good idea. ;) My current use case is that I implement the "create" slot because it makes it very easy to intercept the spec and its configuration. It is not passed into "exec" as such, but I need it to

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-07 Thread Petr Viktorin
Petr Viktorin added the comment: Again, what is the use case? That's a real question, I'm not saying it to dismiss your ideas or points of view. It would be very much easier to think about a concrete use case, rather than making a general system for the sake of how easy it is

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-06 Thread Stefan Behnel
Stefan Behnel added the comment: Marcel proposed to disallow main-execution if the extension *might* return anything but a real object (not only if it actually does), but that seems excessive to me. The actual problem is that we consider it unsafe if the module is executed more than once,

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-06 Thread Petr Viktorin
Petr Viktorin added the comment: Do we have a use case for this? I'd rather avoid making it easy to do the wrong thing, unless it's needed. -- ___ Python tracker

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-06 Thread Stefan Behnel
Stefan Behnel added the comment: OTOH, if the created "module" is not a module object, then we could argue that the extension implementation is on its own with that case, and has to do its own re-execution safety checks. -- ___ Python tracker

[issue30403] PEP 547: Running extension modules using -m switch

2017-09-01 Thread Marcel Plch
Marcel Plch added the comment: Sorry for not responding for so long, I didn't work on Python through the summer because of some other matters. Re-execution of the module is not possible, because there is a check on the C level, If you call exec_in_module() on an already initialized module,

[issue30403] PEP 547: Running extension modules using -m switch

2017-07-22 Thread Stefan Behnel
Stefan Behnel added the comment: FYI, I've finally managed to find the time for implementing PEP 489 style module initialisation in Cython. It was so easy that I'm sorry it took me so long to get started. Cython 0.26 is fresh out, so the feature should go into 0.27.

[issue30403] PEP 547: Running extension modules using -m switch

2017-05-31 Thread Nick Coghlan
Nick Coghlan added the comment: This proposal is now PEP 547: https://github.com/python/peps/commit/cd84e206f58cf929eea235fb894cff1db2a1dabf -- title: Running extension modules using -m switch -> PEP 547: Running extension modules using -m switch