Fixed #23492 -- Restored F.__deepcopy__.

This reverts commit 3a66035107a640c4905f0a5f247a45f32dbe16d7.
A regression test was also added.