Documentation
In the documentation for PyDict_Next it is mentioned that the method is not safe in the free-threaded build and it is suggested to use a critical section. With the critical section the usage of PyDict_Next itself is safe. But the references set to key and value are borrowed references, which are not safe to use when the critical section lock is suspended inside the while loop.
(noted in #119438 (comment))
The documentation should mention the usage of strong references.
Linked PRs