[Python-Dev] Pre-PEP: Redesigning extension modules

Stefan Behnel stefan_ml at behnel.de
Sat Aug 24 15:07:12 CEST 2013


Antoine Pitrou, 24.08.2013 15:00:
> On Sat, 24 Aug 2013 14:51:42 +0200
> Stefan Behnel wrote:
>> Antoine Pitrou, 24.08.2013 13:53:
>>> This would also imply extension module have to be subclasses of the
>>> built-in module type. They can't be arbitrary objects like Stefan
>>> proposed. I'm not sure what the latter enables, but it would probably
>>> make things more difficult internally.
>>
>> My line of thought was more like: if Python code can stick anything into
>> sys.modules and the runtime doesn't care, why can't extension modules stick
>> anything into sys.modules as well?
>>
>> I can't really see the advantage of requiring a subtype here. Or even just
>> a type, as I said.
> 
> sys.modules doesn't care indeed. There's still the whole
> extension-specific code, though, i.e. the eternal PyModuleDef store
> and the state management routines. How much of it would remain with
> your proposal?

PEP 3121 would no longer be necessary. Extension types can do all we need.
No more special casing of modules, that was the idea.

Stefan




More information about the Python-Dev mailing list