◐ Shell
clean mode source ↗

gh-129280: Avoid cyclic reference in contextlib.contextmanager by user202729 · Pull Request #129276 · python/cpython

We don't have any guarantees about reference counting,

I know that very well. But…

6 years ago, there was a difficult to debug issue with SageMath sagemath/sage#24986 , and the developers concluded using that hacky reference counting solution is the best available workaround.

Turns out it causes additional issues later: sagemath/sage#39224

There exists a better solution, see sagemath/cysignals#215 (comment) , but while it is not yet implemented (there are a lot of places that need to be changed in the code base) I try to make the best of what is available.

If the developers originally implemented the proper solution, we wouldn't be in this situation. But removing the workaround entirely before implementing the proper solution seems impractical at this point.


(in the meantime, I'll try to figure out how to write test case and blurb, but I'd appreciate any help if possible)