Message414468
> Could we (or others) end up with unguarded stale caches if some buggy extension forgets to chain the calls correctly?
Yes. I can really go either way on this. I initially opted for simplicity in the core support at the cost of asking a bit more of clients, on the theory that a) there are lots of ways for a buggy C extension to cause crashes with bad use of the C API, and b) I don't expect there to be very many extensions using this API. But it's also true that the consequences of a mistake here could be hard to debug (and easily blamed to the wrong place), and there might turn out to be more clients for dict-watching than I expect! If the consensus is to prefer CPython tracking an array of callbacks instead, we can try that.
> when you say "only one global callback": does that mean per-interpreter, or per-process?
Good question! The currently proposed API suggests per-process, but it's not a question I've given a lot of thought to yet; open to suggestions. It seems like in general the preference is to avoid global state and instead tie things to an interpreter instance? I'll need to do a bit of research to understand exactly how that would affect the implementation. Doesn't seem like it should be a problem, though it might make the lookup at write time to see if we have a callback a bit slower. |
|
Date |
User |
Action |
Args |
2022-03-03 20:31:55 | carljm | set | recipients:
+ carljm, barry, gregory.p.smith, dino.viehland, Mark.Shannon, brandtbucher, itamaro |
2022-03-03 20:31:55 | carljm | set | messageid: <1646339515.72.0.710710981558.issue46896@roundup.psfhosted.org> |
2022-03-03 20:31:55 | carljm | link | issue46896 messages |
2022-03-03 20:31:55 | carljm | create | |
|