[pypy-dev] FAQ entry

William ML Leslie william.leslie.ttg at gmail.com
Fri Apr 10 10:44:43 CEST 2015


On 8 April 2015 at 04:54, Yuriy Taraday <yorik.sar at gmail.com> wrote:

> Did you miss mailing list intentionally?
>

​Ach no!  I always seem to do this on pypy-dev.  Thanks for pointing that
out.​



>
> On Tue, Apr 7, 2015 at 5:59 PM William ML Leslie <
> william.leslie.ttg at gmail.com> wrote:
>
>> On 8 April 2015 at 00:00, Yuriy Taraday <yorik.sar at gmail.com> wrote:
>>
>>> GC introduces concurrency to user code anyway: call to some __del__
>>> method can happen in any time in user code, so it might be called in a
>>> separate thread just as well
>>>
>>>> ​Obligatory: ​http://wingolog.org/archives/201
>> ​​
>> 2/02/16/unexpected-concurrency
>>
>
> Yes, that's how I see it: one can't bet on where and when finalizers are
> run, so they appear to the rest of the program as if they're run in some
> special thread that wake ups in some scary moments. So a separate thread is
> just as good for them.
>

Except that, up until now, you can expect that __del__ is run ​in /one/ of
the threads you've started.  If you only have one thread, you know exactly
which thread your __del__ will be run in.  So you could make assumptions
about thread-local state when you write such a method.

​Not that I have an opinion here.  __del__ is problematic, and entirely to
be avoided in new code, afaiac.​

-- 
William Leslie

Notice:
Likely much of this email is, by the nature of copyright, covered under
copyright law.  You absolutely MAY reproduce any part of it in accordance
with the copyright law of the nation you are reading this in.  Any attempt
to DENY YOU THOSE RIGHTS would be illegal without prior contractual
agreement.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20150410/80468fb5/attachment.html>


More information about the pypy-dev mailing list