[Python-Dev] PEP 231, __findattr__()

Barry A. Warsaw barry@digicool.com
Mon, 4 Dec 2000 10:13:23 -0500


>>>>> "MvL" == Martin v Loewis <martin@loewis.home.cs.tu-berlin.de> writes:

    MvL> I agree that the current implementation is not
    MvL> thread-safe. To solve that, you'd need to associate with each
    MvL> instance not a single "infindattr" attribute, but a whole set
    MvL> of them - one per "thread of execution" (which would be a
    MvL> thread-id in most threading systems). Of course, that would
    MvL> need some cooperation from the any thread scheme (including
    MvL> uthreads), which would need to provide an identification for
    MvL> a "calling context".

I'm still catching up on several hundred emails over the weekend.  I
had a sneaking suspicion that infindattr wasn't thread-safe, so I'm
convinced this is a bug in the implementation.  One approach might be
to store the info in the thread state object (isn't that how the
recursive repr stop flag is stored?)  That would also save having to
allocate an extra int for every instance (yuck) but might impose a bit
more of a performance overhead.

I'll work more on this later today.
-Barry