monkeypatch _mathtext.Parser.parse() with a threading.Lock() - #598
monkeypatch _mathtext.Parser.parse() with a threading.Lock()#598nvaytet wants to merge 3 commits into
Conversation
|
Good find, I did not remember that PR. I had Claude check that the lock genuinely does what it claims, and discussed whether we still need #597 (concluding to reduce it to docs-only) (Claude's writing below): [...] four threads through Two things still make me want to skip it on our side. It landed upstream: ipympl#621 was merged on 31 July, presumably after your ping. Latest release is still 0.10.0, so there is a real gap, but carrying a copy means double-locking once ipympl cuts a release, and remembering to remove it. More importantly, the parser lock is only the first step of a chain. The comment on ipympl#610 serialized successive chokepoints with a shared RLock and watched the failure move each time:
On top of that, lock contention itself can starve the comm thread, so canvases stay blank until execution finishes anyway. I have not reproduced those downstream steps myself, only the parser race. That is what tips it for me: we would trade a loud traceback for silent blank figures, which is harder to diagnose rather than easier. On your placement question, the top-level I have reduced #597 to documentation only, pointing at |
|
Maybe we should wait for ipympl to be released? |
Copied from matplotlib/ipympl#621
I don't know if this is the right place to put it, with the lazy_loader and everything. We may not want to do that work as soon as we import plopp?
I think we could potentially move it into the
backends/matplotlib/__init__.pybecause the other places where matplotlib is used (e.g. making the colorbar for 3d scatter plots) don't make use ofipympl.Either choice would lead to a somewhat possibly surprising behaviour for other plain MPL figures: