[Python-Dev] [IronPython] Exception for setting attributes of built-in type
Michael Foord
fuzzyman at voidspace.org.uk
Mon Jun 15 19:20:41 CEST 2009
Guido van Rossum wrote:
> On Mon, Jun 15, 2009 at 9:10 AM, Michael Foord<fuzzyman at voidspace.org.uk> wrote:
>
>> Dino Viehland wrote:
>>
>>> Guido wrote:
>>>
>>>> I should add that this policy is also forced somewhat by the existence
>>>> of the "multiple interpreters in one address space" feature, which is
>>>> used e.g. by mod_python. This feature attempts to provide isolation
>>>> between interpreters to the point that each one can have a completely
>>>> different set of modules loaded and can be working on a totally
>>>> different application. The implementation of CPython shares built-in
>>>> types between multiple interpreters (and it wouldn't be easy to change
>>>> this); if you were able to modify a built-in type from one
>>>> interpreter, all other interpreters would see that same modification.
>>>>
>
>
>>> IronPython is in the exact same boat here - we share built-in types
>>> Across multiple Python engines as well.
>>>
>
>
>> And indeed it is needed - if you are working with multiple interpreters
>> (engines in IronPython) you don't want isinstance(something, dict) to fail
>> because it is a dictionary from a different interpreter...
>>
>
> Ah, but that suggests you have sharing between different interpreters.
> If you're doing that, perhaps you shouldn't be using multiple
> interpreters, but instead multiple threads?
>
>
Well, in our use case we use multiple engines to provide an isolated
execution context for every document (the Resolver One spreadsheet
written in IronPython). Each of these has their own calculation thread
as well - but the engine per document structure is nice and clean and
means each document can have its own set of modules loaded without
affecting the other documents (although they share a core set of modules).
Once we move these engines into their own app domains we can completely
isolate each document and apply separate security permissions to each
one. That might mean each document effectively paying the
not-insubstantial startup time hit and we haven't begun to look at how
to mitigate that.
Michael
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
More information about the Python-Dev
mailing list