◐ Shell
clean mode source ↗

Replace PyFunction.code PyMutex with PyAtomicRef for lock-free reads by youknowone · Pull Request #7317 · RustPython/RustPython

Change the code field from PyMutex<PyRef<PyCode>> to PyAtomicRef<PyCode>,
eliminating mutex lock/unlock on every function call. The setter uses
swap_to_temporary_refs for safe deferred drop of the old code object.

@youknowone marked this pull request as ready for review

March 3, 2026 00:05

coderabbitai[bot]

youknowone added a commit to youknowone/RustPython that referenced this pull request

Mar 22, 2026
…ustPython#7317)

Change the code field from PyMutex<PyRef<PyCode>> to PyAtomicRef<PyCode>,
eliminating mutex lock/unlock on every function call. The setter uses
swap_to_temporary_refs for safe deferred drop of the old code object.