Message346143
> I'd prefer correctness to be always there automatically, rather than something the user must remember to enable by setting a flag such as lockCallHandling
Yes, I agree, I was just looking at different approaches while mulling all this over. Correctness-by-default can of course always be implemented by setting lockCallHandling to True by default, which is what I have currently in my benchmark testing.
Re. your change:
- self.handlers.remove(hdlr)
+ newhandlers = list(self.handlers)
+ newhandlers.remove(hdlr)
+ self.handlers = hdlr
Did you mean self.handlers = newhandlers in that last line? That's what I assumed you meant, but you've posted that twice now, so I'm not sure what you're getting at.
I agree that having a slower add/removeHandler is acceptable - certainly better than slowing down Logger.handle(). But I'm not sure about
> so without relying on any GIL locking callHandlers will still see the old list or the new list
on platforms other than CPython, since we can't be sure where thread pre-emption might happen (i.e. it could happen inside a source code line boundary) and locking at least has the benefit of having defined semantics.
The other issue is where someone might have subclassed and overridden add/removeHandler methods, for whatever reason. I know it's unlikely, but one never knows.
I think we're broadly on the same page. I'm just not yet sure what the best approach is :-) |
|
Date |
User |
Action |
Args |
2019-06-20 17:28:20 | vinay.sajip | set | recipients:
+ vinay.sajip, benspiller |
2019-06-20 17:28:20 | vinay.sajip | set | messageid: <1561051700.28.0.962021548423.issue35185@roundup.psfhosted.org> |
2019-06-20 17:28:20 | vinay.sajip | link | issue35185 messages |
2019-06-20 17:28:19 | vinay.sajip | create | |
|